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

improve help for azd init with a branch #2578

Merged
merged 1 commit into from
Jul 31, 2023
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
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