in cmd/acr/root.go [21:64]
func newRootCmd(args []string) *cobra.Command {
// for _, arg := range args {
// fmt.Printf("arg = %s\n", arg)
// }
var rootParams rootParameters
cmd := &cobra.Command{
Use: "acr",
Short: "The Azure Container Registry CLI",
Long: `Welcome to the Azure Container Registry CLI!
To start working with the CLI, run acr --help`,
SilenceUsage: true,
}
flags := cmd.PersistentFlags()
cmd.AddCommand(
newPurgeCmd(&rootParams),
newVersionCmd(),
newLoginCmd(),
newLogoutCmd(),
newTagCmd(&rootParams),
newManifestCmd(&rootParams),
)
// If environment variable ACR_EXPERIMENTAL_CSSC is set to true, add the cssc command to the command list
if isExperimentalCssc, exists := os.LookupEnv("ACR_EXPERIMENTAL_CSSC"); exists && isExperimentalCssc == "true" {
cmd.AddCommand(newCsscCmd(&rootParams))
}
// If environment variable ACR_EXPERIMENTAL_ANNOTATE is set to true, add the annotate command to the command list
if isExperimentalAnnotate, exists := os.LookupEnv("ACR_EXPERIMENTAL_ANNOTATE"); exists && isExperimentalAnnotate == "true" {
cmd.AddCommand(newAnnotateCmd(&rootParams))
}
cmd.PersistentFlags().StringVarP(&rootParams.registryName, "registry", "r", "", "Registry name")
cmd.PersistentFlags().StringVarP(&rootParams.username, "username", "u", "", "Registry username")
cmd.PersistentFlags().StringVarP(&rootParams.password, "password", "p", "", "Registry password")
cmd.Flags().BoolP("help", "h", false, "Print usage")
cmd.Flags().StringArrayVarP(&rootParams.configs, "config", "c", nil, "Auth config paths")
// No parameter is marked as required because the registry could be inferred from a task context, same with username and password
_ = flags.Parse(args)
return cmd
}