Skip to content

Commit 426ad11

Browse files
committed
wrap example commands in quotes for non TTY
1 parent 24e18bd commit 426ad11

7 files changed

Lines changed: 24 additions & 24 deletions

File tree

cmd/add.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ func runAdd(cfg *config.Config, opts *addOptions, args []string) error {
6767

6868
if s.IsFullyMerged() {
6969
cfg.Warningf("All branches in this stack have been merged")
70-
cfg.Printf("Consider creating a new stack with %s", cfg.ColorCyan("gh stack init"))
70+
cfg.Printf("Consider creating a new stack with `%s`", cfg.ColorCyan("gh stack init"))
7171
return nil
7272
}
7373

7474
idx := s.IndexOf(currentBranch)
7575
if idx >= 0 && idx < len(s.Branches)-1 {
76-
cfg.Errorf("can only add branches on top of the stack; checkout the top branch %q first", s.Branches[len(s.Branches)-1].Branch)
76+
cfg.Errorf("can only add branches on top of the stack; run `%s` to switch to %q", cfg.ColorCyan("gh stack top"), s.Branches[len(s.Branches)-1].Branch)
7777
return nil
7878
}
7979

@@ -111,7 +111,7 @@ func runAdd(cfg *config.Config, opts *addOptions, args []string) error {
111111
}
112112
cfg.Successf("Created commit %s on %s", cfg.ColorBold(sha), currentBranch)
113113
cfg.Warningf("Branch %s has no prior commits — adding your commit here instead of creating a new branch", currentBranch)
114-
cfg.Printf("When you're ready for the next layer, run %s again", cfg.ColorCyan("gh stack add"))
114+
cfg.Printf("When you're ready for the next layer, run `%s` again", cfg.ColorCyan("gh stack add"))
115115
return nil
116116
}
117117

cmd/checkout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func interactiveStackPicker(cfg *config.Config, sf *stack.StackFile) (*stack.Sta
145145

146146
if len(sf.Stacks) == 0 {
147147
cfg.Infof("No locally tracked stacks found")
148-
cfg.Printf("Create a stack with %s or check out a specific branch/PR once server-side discovery is available.", cfg.ColorCyan("gh stack init"))
148+
cfg.Printf("Create a stack with `%s` or check out a specific branch/PR once server-side discovery is available.", cfg.ColorCyan("gh stack init"))
149149
return nil, nil
150150
}
151151

cmd/init.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ func runInit(cfg *config.Config, opts *initOptions) error {
296296
}
297297
}
298298

299-
cfg.Printf("To add a new layer to your stack, run %s", cfg.ColorCyan("gh stack add"))
300-
cfg.Printf("When you're ready to push to GitHub and open a stack of PRs, run %s", cfg.ColorCyan("gh stack push"))
299+
cfg.Printf("To add a new layer to your stack, run `%s`", cfg.ColorCyan("gh stack add"))
300+
cfg.Printf("When you're ready to push to GitHub and open a stack of PRs, run `%s`", cfg.ColorCyan("gh stack push"))
301301

302302
return nil
303303
}

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")
29+
cfg.Warningf("`%s` is not yet implemented", cfg.ColorCyan("gh stack merge"))
3030
return nil
3131
}

cmd/rebase.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ func runRebase(cfg *config.Config, opts *rebaseOptions) error {
238238
printConflictDetails(cfg, newBase)
239239
cfg.Printf("")
240240

241-
cfg.Printf("Resolve conflicts on %s, then run %s",
241+
cfg.Printf("Resolve conflicts on %s, then run `%s`",
242242
br.Branch, cfg.ColorCyan("gh stack rebase --continue"))
243-
cfg.Printf("Or abort this operation with %s",
243+
cfg.Printf("Or abort this operation with `%s`",
244244
cfg.ColorCyan("gh stack rebase --abort"))
245245
return fmt.Errorf("rebase conflict on %s", br.Branch)
246246
}
@@ -286,9 +286,9 @@ func runRebase(cfg *config.Config, opts *rebaseOptions) error {
286286
printConflictDetails(cfg, base)
287287
cfg.Printf("")
288288

289-
cfg.Printf("Resolve conflicts on %s, then run %s",
289+
cfg.Printf("Resolve conflicts on %s, then run `%s`",
290290
br.Branch, cfg.ColorCyan("gh stack rebase --continue"))
291-
cfg.Printf("Or abort this operation with %s",
291+
cfg.Printf("Or abort this operation with `%s`",
292292
cfg.ColorCyan("gh stack rebase --abort"))
293293
return fmt.Errorf("rebase conflict on %s", br.Branch)
294294
}
@@ -322,7 +322,7 @@ func runRebase(cfg *config.Config, opts *rebaseOptions) error {
322322
}
323323

324324
cfg.Printf("%s rebased locally with %s", rangeDesc, s.Trunk.Branch)
325-
cfg.Printf("To push up your changes and open/update the stack of PRs, run %s",
325+
cfg.Printf("To push up your changes and open/update the stack of PRs, run `%s`",
326326
cfg.ColorCyan("gh stack push"))
327327

328328
return nil
@@ -436,9 +436,9 @@ func continueRebase(cfg *config.Config, gitDir string) error {
436436
cfg.Warningf("Rebasing %s onto %s — conflict", branchName, newBase)
437437
printConflictDetails(cfg, newBase)
438438
cfg.Printf("")
439-
cfg.Printf("Resolve conflicts on %s, then run %s",
439+
cfg.Printf("Resolve conflicts on %s, then run `%s`",
440440
branchName, cfg.ColorCyan("gh stack rebase --continue"))
441-
cfg.Printf("Or abort this operation with %s",
441+
cfg.Printf("Or abort this operation with `%s`",
442442
cfg.ColorCyan("gh stack rebase --abort"))
443443
return fmt.Errorf("rebase conflict on %s", branchName)
444444
}
@@ -476,9 +476,9 @@ func continueRebase(cfg *config.Config, gitDir string) error {
476476
cfg.Warningf("Rebasing %s onto %s — conflict", branchName, base)
477477
printConflictDetails(cfg, base)
478478
cfg.Printf("")
479-
cfg.Printf("Resolve conflicts on %s, then run %s",
479+
cfg.Printf("Resolve conflicts on %s, then run `%s`",
480480
branchName, cfg.ColorCyan("gh stack rebase --continue"))
481-
cfg.Printf("Or abort this operation with %s",
481+
cfg.Printf("Or abort this operation with `%s`",
482482
cfg.ColorCyan("gh stack rebase --abort"))
483483
return fmt.Errorf("rebase conflict on %s", branchName)
484484
}
@@ -497,7 +497,7 @@ func continueRebase(cfg *config.Config, gitDir string) error {
497497
_ = stack.Save(gitDir, sf)
498498

499499
cfg.Printf("All branches in stack rebased locally with %s", s.Trunk.Branch)
500-
cfg.Printf("To push up your changes and open/update the stack of PRs, run %s",
500+
cfg.Printf("To push up your changes and open/update the stack of PRs, run `%s`",
501501
cfg.ColorCyan("gh stack push"))
502502

503503
return nil
@@ -594,6 +594,6 @@ func printConflictDetails(cfg *config.Config, branch string) {
594594
cfg.Printf(" %s", cfg.ColorCyan("======="))
595595
cfg.Printf(" %s (changes being rebased)", cfg.ColorCyan(">>>>>>>"))
596596
cfg.Printf(" 2. Edit the file to keep the desired changes and remove the markers")
597-
cfg.Printf(" 3. Stage resolved files: %s", cfg.ColorCyan("git add <file>"))
598-
cfg.Printf(" 4. Continue the rebase: %s", cfg.ColorCyan("gh stack rebase --continue"))
597+
cfg.Printf(" 3. Stage resolved files: `%s`", cfg.ColorCyan("git add <file>"))
598+
cfg.Printf(" 4. Continue the rebase: `%s`", cfg.ColorCyan("gh stack rebase --continue"))
599599
}

cmd/sync.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func runSync(cfg *config.Config, _ *syncOptions) error {
169169

170170
cfg.Errorf("Conflict detected rebasing %s onto %s", br.Branch, newBase)
171171
reportRestoreStatus(cfg, restoreErrors)
172-
cfg.Printf(" Run %s to resolve conflicts interactively.",
172+
cfg.Printf(" Run `%s` to resolve conflicts interactively.",
173173
cfg.ColorCyan("gh stack rebase"))
174174
conflicted = true
175175
break
@@ -201,7 +201,7 @@ func runSync(cfg *config.Config, _ *syncOptions) error {
201201

202202
cfg.Errorf("Conflict detected rebasing %s onto %s", br.Branch, base)
203203
reportRestoreStatus(cfg, restoreErrors)
204-
cfg.Printf(" Run %s to resolve conflicts interactively.",
204+
cfg.Printf(" Run `%s` to resolve conflicts interactively.",
205205
cfg.ColorCyan("gh stack rebase"))
206206
conflicted = true
207207
break
@@ -235,11 +235,11 @@ func runSync(cfg *config.Config, _ *syncOptions) error {
235235
if err := git.Push(remote, branches, force, true); err != nil {
236236
if !force {
237237
cfg.Warningf("Push failed — branches may need force push after rebase")
238-
cfg.Printf(" Run %s to push with --force-with-lease.",
238+
cfg.Printf(" Run `%s` to push with --force-with-lease.",
239239
cfg.ColorCyan("gh stack push"))
240240
} else {
241241
cfg.Warningf("Push failed: %v", err)
242-
cfg.Printf(" Run %s to retry.", cfg.ColorCyan("gh stack push"))
242+
cfg.Printf(" Run `%s` to retry.", cfg.ColorCyan("gh stack push"))
243243
}
244244
} else {
245245
cfg.Successf("Pushed %d branches", len(branches))

cmd/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func loadStack(cfg *config.Config, branch string) (*loadStackResult, error) {
7878
} else {
7979
cfg.Errorf("current branch %q is not part of a stack", branch)
8080
}
81-
cfg.Printf("Checkout an existing stack using %s or create a new stack using %s",
81+
cfg.Printf("Checkout an existing stack using `%s` or create a new stack using `%s`",
8282
cfg.ColorCyan("gh stack checkout"), cfg.ColorCyan("gh stack init"))
8383
return nil, fmt.Errorf("branch %q is not part of a stack", branch)
8484
}

0 commit comments

Comments
 (0)