@@ -49,14 +49,13 @@ func newGetCmd(ctx context.Context) (cmd *cobra.Command) {
4949 flags := cmd .Flags ()
5050 opt .addFlags (flags )
5151 opt .addPlatformFlags (flags )
52+ opt .addDownloadFlags (flags )
5253 flags .StringVarP (& opt .Output , "output" , "o" , "" , "Write output to <file> instead of stdout." )
5354 flags .BoolVarP (& opt .AcceptPreRelease , "accept-preRelease" , "" , false ,
5455 "If you accept preRelease as the binary asset from GitHub" )
5556 flags .BoolVarP (& opt .AcceptPreRelease , "pre" , "" , false ,
5657 "Same with option --accept-preRelease" )
5758 flags .BoolVarP (& opt .Force , "force" , "f" , false , "Overwrite the exist file if this is true" )
58- flags .IntVarP (& opt .Mod , "mod" , "" , - 1 , "The file permission, -1 means using the system default" )
59- flags .BoolVarP (& opt .SkipTLS , "skip-tls" , "k" , false , "Skip the TLS" )
6059
6160 flags .DurationVarP (& opt .Timeout , "timeout" , "" , 15 * time .Minute ,
6261 `The default timeout in seconds with the HTTP request` )
@@ -143,6 +142,11 @@ const (
143142 ProviderGitee = "gitee"
144143)
145144
145+ func (o * downloadOption ) addDownloadFlags (flags * pflag.FlagSet ) {
146+ flags .IntVarP (& o .Mod , "mod" , "" , - 1 , "The file permission, -1 means using the system default" )
147+ flags .BoolVarP (& o .SkipTLS , "skip-tls" , "k" , false , "Skip the TLS" )
148+ }
149+
146150func (o * downloadOption ) fetch () (err error ) {
147151 if ! o .Fetch {
148152 o .wait .Add (1 )
@@ -331,7 +335,10 @@ func (o *downloadOption) runE(cmd *cobra.Command, args []string) (err error) {
331335
332336 // set file permission
333337 if o .Mod != - 1 {
334- err = sysos .Chmod (o .Output , fs .FileMode (o .Mod ))
338+ logger .Printf ("Setting file permission to %d" , o .Mod )
339+ if err = sysos .Chmod (o .Output , fs .FileMode (o .Mod )); err != nil {
340+ return
341+ }
335342 }
336343
337344 if err == nil {
0 commit comments