mirror of https://github.com/docker/compose.git
remove all references to cli from compose.v2 cmd package
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
52df801287
commit
fcb91096b8
|
@ -23,12 +23,13 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
formatter2 "github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
apicontext "github.com/docker/compose-cli/api/context"
|
apicontext "github.com/docker/compose-cli/api/context"
|
||||||
"github.com/docker/compose-cli/api/context/store"
|
"github.com/docker/compose-cli/api/context/store"
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/cli/mobycli"
|
"github.com/docker/compose-cli/cli/mobycli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ func runList(cmd *cobra.Command, opts lsOpts) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
format := strings.ToLower(strings.ReplaceAll(opts.format, " ", ""))
|
format := strings.ToLower(strings.ReplaceAll(opts.format, " ", ""))
|
||||||
if format != "" && format != formatter.JSON && format != formatter.PRETTY && format != formatter.TemplateLegacyJSON {
|
if format != "" && format != formatter2.JSON && format != formatter2.PRETTY && format != formatter2.TemplateLegacyJSON {
|
||||||
mobycli.Exec(cmd.Root())
|
mobycli.Exec(cmd.Root())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -91,15 +92,15 @@ func runList(cmd *cobra.Command, opts lsOpts) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.json || format == formatter.JSON {
|
if opts.json || format == formatter2.JSON {
|
||||||
opts.format = formatter.JSON
|
opts.format = formatter2.JSON
|
||||||
}
|
}
|
||||||
if format == formatter.TemplateLegacyJSON {
|
if format == formatter2.TemplateLegacyJSON {
|
||||||
opts.format = formatter.TemplateLegacyJSON
|
opts.format = formatter2.TemplateLegacyJSON
|
||||||
}
|
}
|
||||||
|
|
||||||
view := viewFromContextList(contexts, currentContext)
|
view := viewFromContextList(contexts, currentContext)
|
||||||
return formatter.Print(view, opts.format, os.Stdout,
|
return formatter2.Print(view, opts.format, os.Stdout,
|
||||||
func(w io.Writer) {
|
func(w io.Writer) {
|
||||||
for _, c := range view {
|
for _, c := range view {
|
||||||
contextName := c.Name
|
contextName := c.Name
|
||||||
|
|
|
@ -20,12 +20,13 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/hashicorp/go-multierror"
|
"github.com/hashicorp/go-multierror"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
apicontext "github.com/docker/compose-cli/api/context"
|
apicontext "github.com/docker/compose-cli/api/context"
|
||||||
"github.com/docker/compose-cli/api/context/store"
|
"github.com/docker/compose-cli/api/context/store"
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type removeOpts struct {
|
type removeOpts struct {
|
||||||
|
|
|
@ -20,6 +20,8 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/Azure/go-autorest/autorest/to"
|
"github.com/Azure/go-autorest/autorest/to"
|
||||||
"github.com/compose-spec/compose-go/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -27,7 +29,6 @@ import (
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/client"
|
"github.com/docker/compose-cli/api/client"
|
||||||
"github.com/docker/compose-cli/api/containers"
|
"github.com/docker/compose-cli/api/containers"
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// InspectCommand inspects into containers
|
// InspectCommand inspects into containers
|
||||||
|
|
|
@ -20,12 +20,13 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/hashicorp/go-multierror"
|
"github.com/hashicorp/go-multierror"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/client"
|
"github.com/docker/compose-cli/api/client"
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/pkg/api"
|
"github.com/docker/compose-cli/pkg/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,13 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
formatter3 "github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/client"
|
"github.com/docker/compose-cli/api/client"
|
||||||
"github.com/docker/compose-cli/api/containers"
|
"github.com/docker/compose-cli/api/containers"
|
||||||
formatter2 "github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/utils/formatter"
|
"github.com/docker/compose-cli/utils/formatter"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -89,11 +90,11 @@ func runPs(ctx context.Context, opts psOpts) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.json {
|
if opts.json {
|
||||||
opts.format = formatter2.JSON
|
opts.format = formatter3.JSON
|
||||||
}
|
}
|
||||||
|
|
||||||
view := viewFromContainerList(containerList)
|
view := viewFromContainerList(containerList)
|
||||||
return formatter2.Print(view, opts.format, os.Stdout, func(w io.Writer) {
|
return formatter3.Print(view, opts.format, os.Stdout, func(w io.Writer) {
|
||||||
for _, c := range view {
|
for _, c := range view {
|
||||||
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", c.ID, c.Image, c.Command, c.Status,
|
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", c.ID, c.Image, c.Command, c.Status,
|
||||||
strings.Join(c.Ports, ", "))
|
strings.Join(c.Ports, ", "))
|
||||||
|
|
|
@ -20,13 +20,14 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/hashicorp/go-multierror"
|
"github.com/hashicorp/go-multierror"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/client"
|
"github.com/docker/compose-cli/api/client"
|
||||||
"github.com/docker/compose-cli/api/containers"
|
"github.com/docker/compose-cli/api/containers"
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/pkg/api"
|
"github.com/docker/compose-cli/pkg/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,12 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/client"
|
"github.com/docker/compose-cli/api/client"
|
||||||
"github.com/docker/compose-cli/api/secrets"
|
"github.com/docker/compose-cli/api/secrets"
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SecretCommand manage secrets
|
// SecretCommand manage secrets
|
||||||
|
|
|
@ -20,12 +20,13 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/hashicorp/go-multierror"
|
"github.com/hashicorp/go-multierror"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/client"
|
"github.com/docker/compose-cli/api/client"
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/pkg/api"
|
"github.com/docker/compose-cli/pkg/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,13 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/hashicorp/go-multierror"
|
"github.com/hashicorp/go-multierror"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/client"
|
"github.com/docker/compose-cli/api/client"
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/pkg/api"
|
"github.com/docker/compose-cli/pkg/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,12 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/cli/cli"
|
"github.com/docker/cli/cli"
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/cli/mobycli"
|
"github.com/docker/compose-cli/cli/mobycli"
|
||||||
"github.com/docker/compose-cli/internal"
|
"github.com/docker/compose-cli/internal"
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,11 +20,11 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
format "github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/aci"
|
"github.com/docker/compose-cli/aci"
|
||||||
"github.com/docker/compose-cli/api/client"
|
"github.com/docker/compose-cli/api/client"
|
||||||
"github.com/docker/compose-cli/api/context/store"
|
"github.com/docker/compose-cli/api/context/store"
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
format "github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/ecs"
|
"github.com/docker/compose-cli/ecs"
|
||||||
"github.com/docker/compose-cli/pkg/progress"
|
"github.com/docker/compose-cli/pkg/progress"
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ func rmVolume() *cobra.Command {
|
||||||
}
|
}
|
||||||
fmt.Println(id)
|
fmt.Println(id)
|
||||||
}
|
}
|
||||||
formatter.SetMultiErrorFormat(errs)
|
format.SetMultiErrorFormat(errs)
|
||||||
return errs.ErrorOrNil()
|
return errs.ErrorOrNil()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,12 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
formatter2 "github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/client"
|
"github.com/docker/compose-cli/api/client"
|
||||||
"github.com/docker/compose-cli/api/volumes"
|
"github.com/docker/compose-cli/api/volumes"
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type listVolumeOpts struct {
|
type listVolumeOpts struct {
|
||||||
|
@ -55,14 +56,14 @@ func listVolume() *cobra.Command {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
view := viewFromVolumeList(vols)
|
view := viewFromVolumeList(vols)
|
||||||
return formatter.Print(view, opts.format, os.Stdout, func(w io.Writer) {
|
return formatter2.Print(view, opts.format, os.Stdout, func(w io.Writer) {
|
||||||
for _, vol := range view {
|
for _, vol := range view {
|
||||||
_, _ = fmt.Fprintf(w, "%s\t%s\n", vol.ID, vol.Description)
|
_, _ = fmt.Fprintf(w, "%s\t%s\n", vol.ID, vol.Description)
|
||||||
}
|
}
|
||||||
}, "ID", "DESCRIPTION")
|
}, "ID", "DESCRIPTION")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
cmd.Flags().StringVar(&opts.format, "format", formatter.PRETTY, "Format the output. Values: [pretty | json]. (Default: pretty)")
|
cmd.Flags().StringVar(&opts.format, "format", formatter2.PRETTY, "Format the output. Values: [pretty | json]. (Default: pretty)")
|
||||||
cmd.Flags().BoolVarP(&opts.quiet, "quiet", "q", false, "Only display IDs")
|
cmd.Flags().BoolVarP(&opts.quiet, "quiet", "q", false, "Only display IDs")
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,7 @@ func main() {
|
||||||
|
|
||||||
// On default context, "compose" is implemented by CLI Plugin
|
// On default context, "compose" is implemented by CLI Plugin
|
||||||
proxy := api.NewServiceProxy().WithService(service.ComposeService())
|
proxy := api.NewServiceProxy().WithService(service.ComposeService())
|
||||||
command := compose2.RootCommand(ctype, proxy)
|
command := compose2.RootCommand(proxy)
|
||||||
|
|
||||||
if ctype == store.AciContextType {
|
if ctype == store.AciContextType {
|
||||||
customizeCliForACI(command, proxy)
|
customizeCliForACI(command, proxy)
|
||||||
|
|
|
@ -25,6 +25,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/cli"
|
"github.com/compose-spec/compose-go/cli"
|
||||||
|
@ -35,8 +37,6 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/context/store"
|
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/pkg/api"
|
"github.com/docker/compose-cli/pkg/api"
|
||||||
"github.com/docker/compose-cli/pkg/compose"
|
"github.com/docker/compose-cli/pkg/compose"
|
||||||
)
|
)
|
||||||
|
@ -198,7 +198,7 @@ func (o *projectOptions) toProjectOptions(po ...cli.ProjectOptionsFn) (*cli.Proj
|
||||||
}
|
}
|
||||||
|
|
||||||
// RootCommand returns the compose command with its child commands
|
// RootCommand returns the compose command with its child commands
|
||||||
func RootCommand(contextType string, backend api.Service) *cobra.Command {
|
func RootCommand(backend api.Service) *cobra.Command {
|
||||||
opts := projectOptions{}
|
opts := projectOptions{}
|
||||||
var (
|
var (
|
||||||
ansi string
|
ansi string
|
||||||
|
@ -247,10 +247,6 @@ func RootCommand(contextType string, backend api.Service) *cobra.Command {
|
||||||
opts.ProjectDir = opts.WorkDir
|
opts.ProjectDir = opts.WorkDir
|
||||||
fmt.Fprint(os.Stderr, aec.Apply("option '--workdir' is DEPRECATED at root level! Please use '--project-directory' instead.\n", aec.RedF))
|
fmt.Fprint(os.Stderr, aec.Apply("option '--workdir' is DEPRECATED at root level! Please use '--project-directory' instead.\n", aec.RedF))
|
||||||
}
|
}
|
||||||
if contextType == store.DefaultContextType || contextType == store.LocalContextType {
|
|
||||||
Warning = "The new 'docker compose' command is currently experimental. " +
|
|
||||||
"To provide feedback or request new features please open issues at https://github.com/docker/compose-cli"
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -262,8 +258,8 @@ func RootCommand(contextType string, backend api.Service) *cobra.Command {
|
||||||
restartCommand(&opts, backend),
|
restartCommand(&opts, backend),
|
||||||
stopCommand(&opts, backend),
|
stopCommand(&opts, backend),
|
||||||
psCommand(&opts, backend),
|
psCommand(&opts, backend),
|
||||||
listCommand(contextType, backend),
|
listCommand(backend),
|
||||||
logsCommand(&opts, contextType, backend),
|
logsCommand(&opts, backend),
|
||||||
convertCommand(&opts, backend),
|
convertCommand(&opts, backend),
|
||||||
killCommand(&opts, backend),
|
killCommand(&opts, backend),
|
||||||
runCommand(&opts, backend),
|
runCommand(&opts, backend),
|
||||||
|
@ -276,17 +272,12 @@ func RootCommand(contextType string, backend api.Service) *cobra.Command {
|
||||||
portCommand(&opts, backend),
|
portCommand(&opts, backend),
|
||||||
imagesCommand(&opts, backend),
|
imagesCommand(&opts, backend),
|
||||||
versionCommand(),
|
versionCommand(),
|
||||||
)
|
|
||||||
|
|
||||||
if contextType == store.LocalContextType || contextType == store.DefaultContextType {
|
|
||||||
command.AddCommand(
|
|
||||||
buildCommand(&opts, backend),
|
buildCommand(&opts, backend),
|
||||||
pushCommand(&opts, backend),
|
pushCommand(&opts, backend),
|
||||||
pullCommand(&opts, backend),
|
pullCommand(&opts, backend),
|
||||||
createCommand(&opts, backend),
|
createCommand(&opts, backend),
|
||||||
copyCommand(&opts, backend),
|
copyCommand(&opts, backend),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
command.Flags().SetInterspersed(false)
|
command.Flags().SetInterspersed(false)
|
||||||
opts.addProjectFlags(command.Flags())
|
opts.addProjectFlags(command.Flags())
|
||||||
command.Flags().StringVar(&ansi, "ansi", "auto", `Control when to print ANSI control characters ("never"|"always"|"auto")`)
|
command.Flags().StringVar(&ansi, "ansi", "auto", `Control when to print ANSI control characters ("never"|"always"|"auto")`)
|
||||||
|
|
|
@ -24,11 +24,12 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
formatter2 "github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/pkg/api"
|
"github.com/docker/compose-cli/pkg/api"
|
||||||
"github.com/docker/compose-cli/pkg/utils"
|
"github.com/docker/compose-cli/pkg/utils"
|
||||||
)
|
)
|
||||||
|
@ -88,7 +89,7 @@ func runImages(ctx context.Context, backend api.Service, opts imageOptions, serv
|
||||||
return images[i].ContainerName < images[j].ContainerName
|
return images[i].ContainerName < images[j].ContainerName
|
||||||
})
|
})
|
||||||
|
|
||||||
return formatter.Print(images, formatter.PRETTY, os.Stdout,
|
return formatter2.Print(images, formatter2.PRETTY, os.Stdout,
|
||||||
func(w io.Writer) {
|
func(w io.Writer) {
|
||||||
for _, img := range images {
|
for _, img := range images {
|
||||||
id := stringid.TruncateID(img.ID)
|
id := stringid.TruncateID(img.ID)
|
||||||
|
|
|
@ -23,11 +23,11 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/docker/cli/opts"
|
"github.com/docker/cli/opts"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/context/store"
|
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/pkg/api"
|
"github.com/docker/compose-cli/pkg/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ type lsOptions struct {
|
||||||
Filter opts.FilterOpt
|
Filter opts.FilterOpt
|
||||||
}
|
}
|
||||||
|
|
||||||
func listCommand(contextType string, backend api.Service) *cobra.Command {
|
func listCommand(backend api.Service) *cobra.Command {
|
||||||
opts := lsOptions{Filter: opts.NewFilterOpt()}
|
opts := lsOptions{Filter: opts.NewFilterOpt()}
|
||||||
lsCmd := &cobra.Command{
|
lsCmd := &cobra.Command{
|
||||||
Use: "ls",
|
Use: "ls",
|
||||||
|
@ -51,9 +51,7 @@ func listCommand(contextType string, backend api.Service) *cobra.Command {
|
||||||
lsCmd.Flags().StringVar(&opts.Format, "format", "pretty", "Format the output. Values: [pretty | json].")
|
lsCmd.Flags().StringVar(&opts.Format, "format", "pretty", "Format the output. Values: [pretty | json].")
|
||||||
lsCmd.Flags().BoolVarP(&opts.Quiet, "quiet", "q", false, "Only display IDs.")
|
lsCmd.Flags().BoolVarP(&opts.Quiet, "quiet", "q", false, "Only display IDs.")
|
||||||
lsCmd.Flags().Var(&opts.Filter, "filter", "Filter output based on conditions provided.")
|
lsCmd.Flags().Var(&opts.Filter, "filter", "Filter output based on conditions provided.")
|
||||||
if contextType == store.DefaultContextType {
|
|
||||||
lsCmd.Flags().BoolVarP(&opts.All, "all", "a", false, "Show all stopped Compose projects")
|
lsCmd.Flags().BoolVarP(&opts.All, "all", "a", false, "Show all stopped Compose projects")
|
||||||
}
|
|
||||||
|
|
||||||
return lsCmd
|
return lsCmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/context/store"
|
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/pkg/api"
|
"github.com/docker/compose-cli/pkg/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ type logsOptions struct {
|
||||||
timestamps bool
|
timestamps bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func logsCommand(p *projectOptions, contextType string, backend api.Service) *cobra.Command {
|
func logsCommand(p *projectOptions, backend api.Service) *cobra.Command {
|
||||||
opts := logsOptions{
|
opts := logsOptions{
|
||||||
projectOptions: p,
|
projectOptions: p,
|
||||||
}
|
}
|
||||||
|
@ -58,10 +58,7 @@ func logsCommand(p *projectOptions, contextType string, backend api.Service) *co
|
||||||
flags.BoolVar(&opts.noColor, "no-color", false, "Produce monochrome output.")
|
flags.BoolVar(&opts.noColor, "no-color", false, "Produce monochrome output.")
|
||||||
flags.BoolVar(&opts.noPrefix, "no-log-prefix", false, "Don't print prefix in logs.")
|
flags.BoolVar(&opts.noPrefix, "no-log-prefix", false, "Don't print prefix in logs.")
|
||||||
flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps.")
|
flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps.")
|
||||||
|
|
||||||
if contextType == store.DefaultContextType {
|
|
||||||
flags.StringVar(&opts.tail, "tail", "all", "Number of lines to show from the end of the logs for each container.")
|
flags.StringVar(&opts.tail, "tail", "all", "Number of lines to show from the end of the logs for each container.")
|
||||||
}
|
|
||||||
return logsCmd
|
return logsCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,12 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
formatter2 "github.com/docker/cli/cli/command/formatter"
|
formatter2 "github.com/docker/cli/cli/command/formatter"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/pkg/api"
|
"github.com/docker/compose-cli/pkg/api"
|
||||||
"github.com/docker/compose-cli/pkg/utils"
|
"github.com/docker/compose-cli/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,10 +23,11 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/compose-spec/compose-go/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/pkg/api"
|
"github.com/docker/compose-cli/pkg/api"
|
||||||
"github.com/docker/compose-cli/pkg/utils"
|
"github.com/docker/compose-cli/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,9 +19,10 @@ package compose
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/docker/compose-cli/cmd/formatter"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/cli/formatter"
|
|
||||||
"github.com/docker/compose-cli/internal"
|
"github.com/docker/compose-cli/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -23,17 +23,21 @@ import (
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/api/context/store"
|
|
||||||
commands "github.com/docker/compose-cli/cmd/compose"
|
commands "github.com/docker/compose-cli/cmd/compose"
|
||||||
"github.com/docker/compose-cli/internal"
|
"github.com/docker/compose-cli/internal"
|
||||||
"github.com/docker/compose-cli/pkg/api"
|
"github.com/docker/compose-cli/pkg/api"
|
||||||
"github.com/docker/compose-cli/pkg/compose"
|
"github.com/docker/compose-cli/pkg/compose"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
commands.Warning = "The new 'docker compose' command is currently experimental. " +
|
||||||
|
"To provide feedback or request new features please open issues at https://github.com/docker/compose-cli"
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
plugin.Run(func(dockerCli command.Cli) *cobra.Command {
|
plugin.Run(func(dockerCli command.Cli) *cobra.Command {
|
||||||
lazyInit := api.NewServiceProxy()
|
lazyInit := api.NewServiceProxy()
|
||||||
cmd := commands.RootCommand(store.DefaultContextType, lazyInit)
|
cmd := commands.RootCommand(lazyInit)
|
||||||
originalPreRun := cmd.PersistentPreRunE
|
originalPreRun := cmd.PersistentPreRunE
|
||||||
cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
|
cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
|
||||||
if err := plugin.PersistentPreRunE(cmd, args); err != nil {
|
if err := plugin.PersistentPreRunE(cmd, args); err != nil {
|
||||||
|
|
|
@ -35,7 +35,7 @@ const descriptionSourcePath = "docs/reference/"
|
||||||
|
|
||||||
func generateCliYaml(opts *options) error {
|
func generateCliYaml(opts *options) error {
|
||||||
cmd := &cobra.Command{Use: "docker"}
|
cmd := &cobra.Command{Use: "docker"}
|
||||||
cmd.AddCommand(compose.RootCommand("local", nil))
|
cmd.AddCommand(compose.RootCommand(nil))
|
||||||
disableFlagsInUseLine(cmd)
|
disableFlagsInUseLine(cmd)
|
||||||
source := filepath.Join(opts.source, descriptionSourcePath)
|
source := filepath.Join(opts.source, descriptionSourcePath)
|
||||||
if err := loadLongDescription(cmd, source); err != nil {
|
if err := loadLongDescription(cmd, source); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue