Skip to content

Commit

Permalink
fix(update-ref): permit source to be passed via environment (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
isometry authored Oct 7, 2024
1 parent 2d92186 commit b97d0ec
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/updateref.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ var updateRefCmd = &cobra.Command{

func init() {
updateRefCmd.Flags().StringP("source", "s", "", "source `ref-or-commit`")
updateRefCmd.MarkFlagRequired("source")
viper.BindPFlag("source", updateRefCmd.Flags().Lookup("source"))

viper.BindEnv("targets", "GHUP_TARGETS")
Expand Down Expand Up @@ -83,6 +82,10 @@ func runUpdateRefCmd(cmd *cobra.Command, args []string) (err error) {
}

sourceRefName := viper.GetString("source")
if sourceRefName == "" {
return errors.New("no source ref specified")
}

var sourceObject string

if util.IsCommitHash(sourceRefName) {
Expand Down

0 comments on commit b97d0ec

Please sign in to comment.