4
4
"flag"
5
5
"fmt"
6
6
"os"
7
- "path"
7
+ "path/filepath"
8
+ "time"
8
9
)
9
10
10
11
// Args contains represents CLI arguments for this program.
@@ -26,7 +27,7 @@ func GetArgs() Args {
26
27
}
27
28
28
29
push := flag .NewFlagSet ("push" , flag .ExitOnError )
29
- push .StringVar (& args .githubBranch , "branch" , path . Base ( os . Args [ 0 ]) , "Git branch to push to." )
30
+ push .StringVar (& args .githubBranch , "branch" , "contribution" , "Git branch to push to." )
30
31
push .IntVar (& args .weeksAgo , "w" , 0 , "Weeks ago of all activity. A value of 2 will move activity two pixels to the left." )
31
32
push .StringVar (& args .githubProject , "project" , "" , "GitHub username/project to push to. (required)" )
32
33
push .Usage = func () {
@@ -62,23 +63,23 @@ func GetArgs() Args {
62
63
// exitWithHelp exits with global help
63
64
func exitWithHelp (preview * flag.FlagSet , push * flag.FlagSet ) {
64
65
fmt .Fprintf (os .Stderr , "Draw an image on your GitHub contribution history.\n " )
65
- fmt .Fprintf (os .Stderr , "By Blaise Kal, 2020 \n \n " )
66
+ fmt .Fprintf (os .Stderr , "By Blaise Kal, %d \n \n " , time . Now (). Year () )
66
67
fmt .Fprintf (os .Stderr , "Preview contribution history graph without pushing\n " )
67
- fmt .Fprintf (os .Stderr , " %s %s -img /path/to/image.png\n " , path .Base (os .Args [0 ]), preview .Name ())
68
+ fmt .Fprintf (os .Stderr , " %s %s -img /path/to/image.png\n " , filepath .Base (os .Args [0 ]), preview .Name ())
68
69
fmt .Fprintf (os .Stderr , "Preview usage and options\n " )
69
- fmt .Fprintf (os .Stderr , " %s %s -help\n \n " , path .Base (os .Args [0 ]), preview .Name ())
70
+ fmt .Fprintf (os .Stderr , " %s %s -help\n \n " , filepath .Base (os .Args [0 ]), preview .Name ())
70
71
fmt .Fprintf (os .Stderr , "Push contribution history graph to GitHub\n " )
71
- fmt .Fprintf (os .Stderr , " %s %s -img /path/to/image.png -project username/project\n " , path .Base (os .Args [0 ]), push .Name ())
72
+ fmt .Fprintf (os .Stderr , " %s %s -img /path/to/image.png -project username/project\n " , filepath .Base (os .Args [0 ]), push .Name ())
72
73
fmt .Fprintf (os .Stderr , "Push usage and options\n " )
73
- fmt .Fprintf (os .Stderr , " %s %s -help\n " , path .Base (os .Args [0 ]), push .Name ())
74
+ fmt .Fprintf (os .Stderr , " %s %s -help\n " , filepath .Base (os .Args [0 ]), push .Name ())
74
75
os .Exit (0 )
75
76
}
76
77
77
78
// helpPreview exits with help on the preview subcommand
78
79
func exitWithPreviewHelp (flagset * flag.FlagSet ) {
79
80
fmt .Fprintf (os .Stderr , "Preview contribution history graph without pushing.\n " )
80
81
fmt .Fprintf (os .Stderr , "Example usage:\n " )
81
- fmt .Fprintf (os .Stderr , " %s %s -img image.png\n \n " , path .Base (os .Args [0 ]), os .Args [1 ])
82
+ fmt .Fprintf (os .Stderr , " %s %s -img image.png\n \n " , filepath .Base (os .Args [0 ]), os .Args [1 ])
82
83
flag .PrintDefaults ()
83
84
flagset .PrintDefaults ()
84
85
os .Exit (0 )
@@ -88,7 +89,7 @@ func exitWithPreviewHelp(flagset *flag.FlagSet) {
88
89
func exitWithPushHelp (flagset * flag.FlagSet ) {
89
90
fmt .Fprintf (os .Stderr , "Push contribution history graph to GitHub\n " )
90
91
fmt .Fprintf (os .Stderr , "Example usage:\n " )
91
- fmt .Fprintf (os .Stderr , " %s %s -project username/project\n \n " , path .Base (os .Args [0 ]), os .Args [1 ])
92
+ fmt .Fprintf (os .Stderr , " %s %s -project username/project\n \n " , filepath .Base (os .Args [0 ]), os .Args [1 ])
92
93
flag .PrintDefaults ()
93
94
flagset .PrintDefaults ()
94
95
os .Exit (0 )
0 commit comments