Skip to content

Auto-select a stack if the current branch is only in that stack #369

@geofflamrock

Description

@geofflamrock

Currently if the user doesn't provide a stack option via --stack then we present a list of stacks for them to choose from. This is fine, but often gets in the way of when you are on a branch in the stack and you just want to always operate on that stack. It slows you down to have to choose the stack, particularly if running multiple commands one after each other.

Change the stack selection so that if the current branch is only in one stack then auto-select that stack.

There will be times when someone wants to operate on a different stack whilst in another one but I think this is ok as a sensible default, they can specify the stack directly using the option. This also mirrors more closely the way that Git commands work e.g. if you run git pull it doesn't ask you which branch you want to pull for, it just uses the current one and assumes you know what you are doing.

Technical notes

  • There is an existing helper method for selecting a stack, add to that.

Acceptance criteria

  • When the current branch is only in one stack for the remote, that stack is selected automatically.
  • The stack name is displayed to the user as per now.
  • Unit tests covering the functionality.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions