Expose `—remove-orphans` in compose down command

Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
Guillaume Tardif 2021-02-03 15:50:49 +01:00
parent 7d0be7ad5a
commit 4b20d77a86
1 changed files with 5 additions and 1 deletions

View File

@ -31,6 +31,7 @@ import (
type downOptions struct {
*projectOptions
removeOrphans bool
}
func downCommand(p *projectOptions) *cobra.Command {
@ -44,6 +45,9 @@ func downCommand(p *projectOptions) *cobra.Command {
return runDown(cmd.Context(), opts)
},
}
flags := downCmd.Flags()
flags.BoolVar(&opts.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file.")
return downCmd
}
@ -66,7 +70,7 @@ func runDown(ctx context.Context, opts downOptions) error {
}
return name, c.ComposeService().Down(ctx, name, compose.DownOptions{
RemoveOrphans: false,
RemoveOrphans: opts.removeOrphans,
Project: project,
})
})