|
@@ -21,18 +21,17 @@ import (
|
|
|
"errors"
|
|
"errors"
|
|
|
"os"
|
|
"os"
|
|
|
|
|
|
|
|
- "github.com/compose-spec/compose-go/cli"
|
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/cobra"
|
|
|
|
|
|
|
|
"github.com/docker/api/client"
|
|
"github.com/docker/api/client"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func logsCommand() *cobra.Command {
|
|
func logsCommand() *cobra.Command {
|
|
|
- opts := cli.ProjectOptions{}
|
|
|
|
|
|
|
+ opts := composeOptions{}
|
|
|
logsCmd := &cobra.Command{
|
|
logsCmd := &cobra.Command{
|
|
|
Use: "logs",
|
|
Use: "logs",
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
- return runLogs(cmd.Context(), &opts)
|
|
|
|
|
|
|
+ return runLogs(cmd.Context(), opts)
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
logsCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name")
|
|
logsCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name")
|
|
@@ -42,7 +41,7 @@ func logsCommand() *cobra.Command {
|
|
|
return logsCmd
|
|
return logsCmd
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func runLogs(ctx context.Context, opts *cli.ProjectOptions) error {
|
|
|
|
|
|
|
+func runLogs(ctx context.Context, opts composeOptions) error {
|
|
|
c, err := client.New(ctx)
|
|
c, err := client.New(ctx)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return err
|
|
return err
|
|
@@ -53,5 +52,9 @@ func runLogs(ctx context.Context, opts *cli.ProjectOptions) error {
|
|
|
return errors.New("compose not implemented in current context")
|
|
return errors.New("compose not implemented in current context")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return composeService.Logs(ctx, opts, os.Stdout)
|
|
|
|
|
|
|
+ options, err := opts.toProjectOptions()
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return err
|
|
|
|
|
+ }
|
|
|
|
|
+ return composeService.Logs(ctx, options, os.Stdout)
|
|
|
}
|
|
}
|