You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(options): add more options of 'git commit' command (#44)
* feat(options): add more options of 'git commit' command
add more options of 'git commit', rename '--add' to '--all'
BREAKING CHANGE: rename '--add' to 'all'
Closes#43
* WIP(options): rename combine
Copy file name to clipboardExpand all lines: internal/git/options.go
+53-4Lines changed: 53 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,67 @@ package git
3
3
import"github.com/spf13/pflag"
4
4
5
5
typeOptionsstruct {
6
+
Quietbool
7
+
Verbosebool
6
8
SignOffbool
7
-
Addbool
9
+
Allbool
10
+
Amendbool
11
+
DryRunbool
12
+
Authorstring
13
+
Datestring
8
14
}
9
15
10
16
funcNewOptions() *Options {
11
17
return&Options{
18
+
Quiet: false,
19
+
Verbose: false,
12
20
SignOff: false,
13
-
Add: false,
21
+
All: false,
22
+
Amend: false,
23
+
DryRun: false,
24
+
Author: "",
25
+
Date: "",
14
26
}
15
27
}
16
28
17
29
func (o*Options) AddFlags(f*pflag.FlagSet) {
18
-
f.BoolVarP(&o.Add, "add", "a", o.Add, "tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.")
19
-
f.BoolVarP(&o.SignOff, "signoff", "s", o.SignOff, "add a Signed-off-by trailer by the committer at the end of the commit log message.")
30
+
// inherits the --dry-run argument from the parent command
31
+
f.BoolVarP(&o.Quiet, "quiet", "q", o.Quiet, "suppress summary after successful commit")
32
+
f.BoolVarP(&o.Verbose, "verbose", "v", o.Verbose, "show diff in commit message template")
33
+
f.StringVar(&o.Author, "author", o.Author, "override author for commit")
34
+
f.StringVar(&o.Date, "date", o.Date, "override date for commit")
35
+
f.BoolVarP(&o.All, "all", "a", o.All, "commit all changed files.")
36
+
f.BoolVarP(&o.SignOff, "signoff", "s", o.SignOff, "add a Signed-off-by trailer.")
Copy file name to clipboardExpand all lines: internal/options/options.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ func New() *Options {
24
24
func (o*Options) AddFlags(f*pflag.FlagSet) {
25
25
o.GitOptions.AddFlags(f)
26
26
27
-
f.BoolVar(&o.DryRun, "dry-run", o.DryRun, "you can use the --dry-run flag to preview the message that would be committed, without really submitting it.")
27
+
f.BoolVar(&o.DryRun, "dry-run", o.DryRun, "do not create a commit, but show the message and list of paths \nthat are to be committed.")
28
28
f.StringVarP(&o.Template, "template", "t", o.Template, "template name to use when multiple templates exist.")
29
29
f.BoolVarP(&o.Default, "default", "d", o.Default, "use the default template, '--default' has a higher priority than '--template'.")
30
30
f.BoolVar(&o.NoTTY, "no-tty", o.NoTTY, "make sure that the TTY (terminal) is never used for any output.")
0 commit comments