mirror of
https://github.com/89luca89/distrobox.git
synced 2026-08-19 01:14:49 -05:00
fix(stop): honor DBX_CONTAINER_NAME when no positional given
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
This commit is contained in:
@@ -55,6 +55,14 @@ func stopAction(ctx context.Context, cmd *cli.Command, cfg *config.Values) error
|
||||
nonInteractive := cmd.Bool("yes")
|
||||
containerNames := cmd.Args().Slice()
|
||||
|
||||
// Shell distrobox-stop seeds container_name from DBX_CONTAINER_NAME
|
||||
// (distrobox-stop:90, 200-202) when no positional and not --all.
|
||||
if !all && len(containerNames) == 0 {
|
||||
if envName := os.Getenv("DBX_CONTAINER_NAME"); envName != "" {
|
||||
containerNames = []string{envName}
|
||||
}
|
||||
}
|
||||
|
||||
options := &commands.StopOptions{
|
||||
ContainerNames: containerNames,
|
||||
NonInteractive: nonInteractive,
|
||||
|
||||
Reference in New Issue
Block a user