diff --git a/internal/runners/branch/list.go b/internal/runners/branch/list.go index 1022f2689a..cada15a95e 100644 --- a/internal/runners/branch/list.go +++ b/internal/runners/branch/list.go @@ -47,5 +47,9 @@ func (l *List) Run() error { project.Branches, )) + if len(project.Branches) > 1 { + l.out.Notice(locale.Tl("branch_switch_notice", "To switch to another branch, run '[ACTIONABLE]state branch switch [/RESET]'.")) + } + return nil } diff --git a/test/integration/branch_int_test.go b/test/integration/branch_int_test.go index 9d1364bc2c..edf03c05ae 100644 --- a/test/integration/branch_int_test.go +++ b/test/integration/branch_int_test.go @@ -26,6 +26,13 @@ func (suite *BranchIntegrationTestSuite) TestBranch_List() { cp := ts.SpawnWithOpts(e2e.OptArgs("branch"), e2e.OptTermTest(termtest.OptVerboseLogger())) // Sometimes there's a space before the line break, unsure exactly why, but hence the regex cp.ExpectRe(`main \(Current\)\s?\n ├─ firstbranch\s?\n │ └─ firstbranchchild\s?\n │ └─ childoffirstbranchchild\s?\n ├─ secondbranch\s?\n └─ thirdbranch`, termtest.OptExpectTimeout(5*time.Second)) + cp.Expect("To switch to another branch,") + cp.ExpectExitCode(0) + + ts.PrepareProject("ActiveState-CLI/small-python", "") + cp = ts.Spawn("branch") + cp.Expect("main") + suite.Assert().NotContains(cp.Snapshot(), "To switch to another branch,") // only shows when multiple branches are listed cp.ExpectExitCode(0) }