Skip to content

Commit

Permalink
improve help for azd init with a branch (#2578)
Browse files Browse the repository at this point in the history
  • Loading branch information
vhvb1989 authored Jul 31, 2023
1 parent c4f9589 commit cf00e22
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions cli/azd/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ func (i *initFlags) Bind(local *pflag.FlagSet, global *internal.GlobalCommandOpt
//nolint:lll
"The template to use when you initialize the project. You can use Full URI, <owner>/<repository>, or <repository> if it's part of the azure-samples organization.",
)
local.StringVarP(&i.templateBranch, "branch", "b", "", "The template branch to initialize from.")
local.StringVarP(
&i.templateBranch,
"branch",
"b",
"",
"The template branch to initialize from. Must be used with a template argument (--template or -t).")
local.StringVar(
&i.subscription,
"subscription",
Expand Down Expand Up @@ -104,7 +109,9 @@ func (i *initAction) Run(ctx context.Context) (*actions.ActionResult, error) {
azdCtx := azdcontext.NewAzdContextWithDirectory(wd)

if i.flags.templateBranch != "" && i.flags.templatePath == "" {
return nil, errors.New("template required when specifying a branch name")
return nil,
errors.New(
"Using branch argument (-b or --branch) requires a template argument (--template or -t) to be specified.")
}

// ensure that git is available
Expand Down
2 changes: 1 addition & 1 deletion cli/azd/cmd/testdata/TestUsage-azd-init.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Usage
azd init [flags]

Flags
-b, --branch string : The template branch to initialize from.
-b, --branch string : The template branch to initialize from. Must be used with a template argument (--template or -t).
--docs : Opens the documentation for azd init in your web browser.
-e, --environment string : The name of the environment to use.
-h, --help : Gets help for init.
Expand Down

0 comments on commit cf00e22

Please sign in to comment.