set default hub branch to master in cscli (#279)

This commit is contained in:
registergoofy 2020-10-01 15:02:53 +02:00 committed by GitHub
parent 9b97633043
commit f0ea8312db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -123,7 +123,7 @@ API interaction:
rootCmd.PersistentFlags().BoolVar(&wrn_lvl, "warning", false, "Set logging to warning.")
rootCmd.PersistentFlags().BoolVar(&err_lvl, "error", false, "Set logging to error.")
rootCmd.PersistentFlags().StringVar(&cwhub.HubBranch, "branch", "", "Override hub branch on github")
rootCmd.PersistentFlags().StringVar(&cwhub.HubBranch, "branch", "master", "Override hub branch on github")
if err := rootCmd.PersistentFlags().MarkHidden("branch"); err != nil {
log.Fatalf("failed to make branch hidden : %s", err)
}

View file

@ -148,7 +148,8 @@ func DownloadItem(target Item, tdir string, overwrite bool, dataFolder string) (
}
//log.Infof("Downloading %s to %s", target.Name, tdir)
req, err := http.NewRequest("GET", fmt.Sprintf(RawFileURLTemplate, HubBranch, target.RemotePath), nil)
uri := fmt.Sprintf(RawFileURLTemplate, HubBranch, target.RemotePath)
req, err := http.NewRequest("GET", uri, nil)
if err != nil {
log.Errorf("%s : request creation failed : %s", target.Name, err)
return target, err
@ -159,7 +160,7 @@ func DownloadItem(target Item, tdir string, overwrite bool, dataFolder string) (
return target, err
}
if resp.StatusCode != 200 {
log.Errorf("%s : non 200 response : %d", target.Name, resp.StatusCode)
log.Errorf("%s : We got an error reaching %s : %d", target.Name, uri, resp.StatusCode)
return target, fmt.Errorf("bad http code")
}
defer resp.Body.Close()