File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -100,13 +100,14 @@ func main() {
100100 return
101101 }
102102
103- if len (os .Args ) < 6 {
103+ if flag .NArg () != 5 {
104+ log .Printf ("Error: Invalid number of arguments (got %d, expected 5)\n \n " , flag .NArg ())
104105 log .Fatal (usage )
105106 }
106107
107- userRepo := strings .Split (os . Args [ 1 ] , "/" )
108+ userRepo := strings .Split (flag . Arg ( 0 ) , "/" )
108109 if len (userRepo ) != 2 {
109- log .Printf ("Error: Invalid format used for username and repository: %s\n \n " , os . Args [ 1 ] )
110+ log .Printf ("Error: Invalid format used for username and repository: %s\n \n " , flag . Arg ( 0 ) )
110111 log .Fatal (usage )
111112 }
112113
@@ -121,22 +122,22 @@ Please refer to https://help.github.com/articles/creating-an-access-token-for-co
121122
122123 if debug {
123124 log .Println ("Glob pattern received: " )
124- log .Println (os . Args [ 5 ] )
125+ log .Println (flag . Arg ( 4 ) )
125126 }
126127
127- filepaths , err := filepath .Glob (os . Args [ 5 ] )
128+ filepaths , err := filepath .Glob (flag . Arg ( 4 ) )
128129 if err != nil {
129- log .Fatalf ("Error: Invalid glob pattern: %s\n " , os . Args [ 5 ] )
130+ log .Fatalf ("Error: Invalid glob pattern: %s\n " , flag . Arg ( 4 ) )
130131 }
131132
132133 if debug {
133134 log .Println ("Expanded glob pattern: " )
134135 log .Printf ("%v\n " , filepaths )
135136 }
136137
137- tag := os . Args [ 2 ]
138- branch := os . Args [ 3 ]
139- desc := os . Args [ 4 ]
138+ tag := flag . Arg ( 1 )
139+ branch := flag . Arg ( 2 )
140+ desc := flag . Arg ( 3 )
140141
141142 CreateRelease (tag , branch , desc , filepaths )
142143 log .Println ("Done" )
You can’t perform that action at this time.
0 commit comments