Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a flag for auto publishing #886

Merged
merged 17 commits into from
Aug 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmd/notary/delegations.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ type delegationCommander struct {
paths []string
allPaths, removeAll, forceYes bool
keyIDs []string

autoPublish bool
}

func (d *delegationCommander) GetCommand() *cobra.Command {
Expand All @@ -66,11 +68,13 @@ func (d *delegationCommander) GetCommand() *cobra.Command {
cmdRemDelg.Flags().StringSliceVar(&d.paths, "paths", nil, "List of paths to remove")
cmdRemDelg.Flags().BoolVarP(&d.forceYes, "yes", "y", false, "Answer yes to the removal question (no confirmation)")
cmdRemDelg.Flags().BoolVar(&d.allPaths, "all-paths", false, "Remove all paths from this delegation")
cmdRemDelg.Flags().BoolVarP(&d.autoPublish, "publish", "p", false, htAutoPublish)
cmd.AddCommand(cmdRemDelg)

cmdAddDelg := cmdDelegationAddTemplate.ToCommand(d.delegationAdd)
cmdAddDelg.Flags().StringSliceVar(&d.paths, "paths", nil, "List of paths to add")
cmdAddDelg.Flags().BoolVar(&d.allPaths, "all-paths", false, "Add all paths to this delegation")
cmdAddDelg.Flags().BoolVarP(&d.autoPublish, "publish", "p", false, htAutoPublish)
cmd.AddCommand(cmdAddDelg)
return cmd
}
Expand Down Expand Up @@ -265,7 +269,7 @@ func (d *delegationCommander) delegationRemove(cmd *cobra.Command, args []string
}
cmd.Println("")

return nil
return maybeAutoPublish(cmd, d.autoPublish, gun, config, d.retriever)
}

// delegationAdd creates a new delegation by adding a public key from a certificate to a specific role in a GUN
Expand Down Expand Up @@ -359,5 +363,6 @@ func (d *delegationCommander) delegationAdd(cmd *cobra.Command, args []string) e
"Addition of delegation role %s %sto repository \"%s\" staged for next publish.\n",
role, addingItems, gun)
cmd.Println("")
return nil

return maybeAutoPublish(cmd, d.autoPublish, gun, config, d.retriever)
}
Loading