Compose as a cli plugin

Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Guillaume Tardif 2021-03-04 19:21:42 +01:00 committed by Nicolas De Loof
parent 85af8cdaaa
commit 1dc97e8c4b
11 changed files with 494 additions and 97 deletions

View file

@ -123,6 +123,14 @@ func Command(contextType string, backend compose.Service) *cobra.Command {
return fmt.Errorf("unknown docker command: %q", "compose "+args[0])
},
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
parent := cmd.Root()
parentPrerun := parent.PersistentPreRunE
if parentPrerun != nil {
err := parentPrerun(cmd, args)
if err != nil {
return err
}
}
if noAnsi {
if ansi != "auto" {
return errors.New(`cannot specify DEPRECATED "--no-ansi" and "--ansi". Please use only "--ansi"`)