MCPcopy Create free account
hub / github.com/git-bug/git-bug / runBugTitleEdit

Function runBugTitleEdit

commands/bug/bug_title_edit.go:40–73  ·  view source on GitHub ↗
(env *execenv.Env, opts bugTitleEditOptions, args []string)

Source from the content-addressed store, hash-verified

38}
39
40func runBugTitleEdit(env *execenv.Env, opts bugTitleEditOptions, args []string) error {
41 b, _, err := ResolveSelected(env.Backend, args)
42 if err != nil {
43 return err
44 }
45
46 snap := b.Snapshot()
47
48 if opts.title == "" {
49 if opts.nonInteractive {
50 env.Err.Println("No title given. Use -m or -F option to specify a title. Aborting.")
51 return nil
52 }
53 opts.title, err = buginput.BugTitleEditorInput(env.Repo, snap.Title)
54 if err == buginput.ErrEmptyTitle {
55 env.Out.Println("Empty title, aborting.")
56 return nil
57 }
58 if err != nil {
59 return err
60 }
61 }
62
63 if opts.title == snap.Title {
64 env.Err.Println("No change, aborting.")
65 }
66
67 _, err = b.SetTitle(text.CleanupOneLine(opts.title))
68 if err != nil {
69 return err
70 }
71
72 return b.Commit()
73}

Callers 1

newBugTitleEditCommandFunction · 0.85

Calls 6

CleanupOneLineFunction · 0.92
ResolveSelectedFunction · 0.85
SnapshotMethod · 0.80
SetTitleMethod · 0.80
PrintlnMethod · 0.65
CommitMethod · 0.65

Tested by

no test coverage detected