Skip to content

Commit 9dc7980

Browse files
committed
output msgs nits
1 parent 910b69c commit 9dc7980

7 files changed

Lines changed: 10 additions & 9 deletions

File tree

cmd/add.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,6 @@ func runAdd(cfg *config.Config, args []string) error {
106106
return nil
107107
}
108108

109-
cfg.Successf("Created and checked out branch %q\n", branchName)
109+
cfg.Successf("Created and checked out branch %q", branchName)
110110
return nil
111111
}

cmd/checkout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ func CheckoutCmd(cfg *config.Config) *cobra.Command {
3838
// 4. Save the stack to local tracking (.git/gh-stack, similar to gh stack init --adopt)
3939
// 5. Switch to the target branch (unless --no-switch is set)
4040
func runCheckout(cfg *config.Config, opts *checkoutOptions) error {
41-
cfg.Warningf("gh stack checkout is not yet implemented\n")
41+
cfg.Warningf("gh stack checkout is not yet implemented")
4242
return nil
4343
}

cmd/feedback.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ func runFeedback(cfg *config.Config, args []string) error {
3737
return err
3838
}
3939

40-
cfg.Successf("Opening feedback form in your browser...\n")
40+
cfg.Successf("Opening feedback form in your browser...")
4141
return nil
4242
}

cmd/merge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ func MergeCmd(cfg *config.Config) *cobra.Command {
2626
// We need a mergeability check for the entire stack
2727
// and an endpoint for merging an entire stack
2828
func runMerge(cfg *config.Config, opts struct{}) error {
29-
cfg.Warningf("gh stack merge is not yet implemented\n")
29+
cfg.Warningf("gh stack merge is not yet implemented")
3030
return nil
3131
}

cmd/rebase.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func runRebase(cfg *config.Config, opts *rebaseOptions) error {
118118
if err := git.Fetch("origin"); err != nil {
119119
cfg.Warningf("Failed to fetch origin: %v", err)
120120
} else {
121-
cfg.Successf("Fetching origin")
121+
cfg.Successf("Fetched origin")
122122
}
123123

124124
chainParts := []string{s.Trunk.Branch}

cmd/root.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cmd
22

33
import (
4+
"fmt"
45
"os"
56

67
"github.com/github/gh-stack/internal/config"
@@ -56,6 +57,7 @@ func RootCmd() *cobra.Command {
5657
func Execute() {
5758
cmd := RootCmd()
5859
if err := cmd.Execute(); err != nil {
60+
fmt.Fprintln(cmd.ErrOrStderr(), err)
5961
os.Exit(1)
6062
}
6163
}

cmd/utils.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package cmd
22

33
import (
44
"fmt"
5-
"os"
65

76
"github.com/cli/go-gh/v2/pkg/prompter"
87
"github.com/github/gh-stack/internal/config"
@@ -30,14 +29,14 @@ func resolveStack(sf *stack.StackFile, branch string, cfg *config.Config) (*stac
3029
return nil, fmt.Errorf("branch %q belongs to multiple stacks; use an interactive terminal to select one", branch)
3130
}
3231

33-
cfg.Warningf("Branch %q is the trunk of multiple stacks\n", branch)
32+
cfg.Warningf("Branch %q is the trunk of multiple stacks", branch)
3433

3534
options := make([]string, len(stacks))
3635
for i, s := range stacks {
3736
options[i] = s.DisplayName()
3837
}
3938

40-
p := prompter.New(os.Stdin, os.Stdout, os.Stderr)
39+
p := prompter.New(cfg.In, cfg.Out, cfg.Err)
4140
selected, err := p.Select("Which stack would you like to use?", "", options)
4241
if err != nil {
4342
return nil, fmt.Errorf("stack selection: %w", err)
@@ -52,7 +51,7 @@ func resolveStack(sf *stack.StackFile, branch string, cfg *config.Config) (*stac
5251
if err := git.CheckoutBranch(topBranch); err != nil {
5352
return nil, fmt.Errorf("failed to checkout branch %s: %w", topBranch, err)
5453
}
55-
cfg.Successf("Switched to %s\n", topBranch)
54+
cfg.Successf("Switched to %s", topBranch)
5655
}
5756

5857
return s, nil

0 commit comments

Comments
 (0)