Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Azure/azure-dev into weilim/compose…
Browse files Browse the repository at this point in the history
…-show
  • Loading branch information
vhvb1989 committed Nov 13, 2024
2 parents def4a61 + d0937f9 commit 94ee21b
Show file tree
Hide file tree
Showing 43 changed files with 146 additions and 157 deletions.
34 changes: 28 additions & 6 deletions cli/azd/cmd/cmd_help.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,39 @@ func getCmdHelpDefaultCommands(cmd *cobra.Command) string {

// getCmdHelpDefaultFlags provides the default implementation for displaying the help flags section.
func getCmdHelpDefaultFlags(cmd *cobra.Command) (result string) {
if cmd.HasAvailableLocalFlags() {
flags := getFlagsDetails(cmd.LocalFlags())
// force the following flags as global flags for display purposes when displaying help.
forceGlobalFlagNames := map[string]struct{}{
"help": {},
"docs": {},
}

forceGlobalFlags := pflag.NewFlagSet("", pflag.ContinueOnError)
localFlags := pflag.NewFlagSet("", pflag.ContinueOnError)

cmd.LocalFlags().VisitAll(func(f *pflag.Flag) {
if _, ok := forceGlobalFlagNames[f.Name]; ok {
forceGlobalFlags.AddFlag(f)
} else {
localFlags.AddFlag(f)
}
})

if localFlags.HasAvailableFlags() {
details := getFlagsDetails(localFlags)
result = fmt.Sprintf("%s\n%s\n",
output.WithBold("%s", output.WithUnderline("Flags")),
flags)
details)
}
if cmd.HasAvailableInheritedFlags() {
globalFlags := getFlagsDetails(cmd.InheritedFlags())

globalFlags := pflag.NewFlagSet("", pflag.ContinueOnError)
globalFlags.AddFlagSet(cmd.InheritedFlags())
globalFlags.AddFlagSet(forceGlobalFlags)

if globalFlags.HasAvailableFlags() {
details := getFlagsDetails(globalFlags)
result += fmt.Sprintf("%s\n%s\n",
output.WithBold("%s", output.WithUnderline("Global Flags")),
globalFlags)
details)
}
return result
}
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-add.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ Add a component to your project. (Alpha)
Usage
azd add [flags]

Flags
--docs : Opens the documentation for azd add in your web browser.
-h, --help : Gets help for add.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd add in your web browser.
-h, --help : Gets help for add.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
4 changes: 2 additions & 2 deletions cli/azd/cmd/testdata/TestUsage-azd-auth-login.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ Flags
--client-certificate string : The path to the client certificate for the service principal to authenticate with.
--client-id string : The client id for the service principal to authenticate with.
--client-secret string : The client secret for the service principal to authenticate with. Set to the empty string to read the value from the console.
--docs : Opens the documentation for azd auth login in your web browser.
--federated-credential-provider string : The provider to use to acquire a federated token to authenticate with.
-h, --help : Gets help for login.
--managed-identity : Use a managed identity to authenticate.
--redirect-port int : Choose the port to be used as part of the redirect URI during interactive login.
--tenant-id string : The tenant id or domain name to authenticate with.
Expand All @@ -20,6 +18,8 @@ Flags
Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd auth login in your web browser.
-h, --help : Gets help for login.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-auth-logout.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ Log out of Azure.
Usage
azd auth logout [flags]

Flags
--docs : Opens the documentation for azd auth logout in your web browser.
-h, --help : Gets help for logout.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd auth logout in your web browser.
-h, --help : Gets help for logout.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-auth.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ Available Commands
login : Log in to Azure.
logout : Log out of Azure.

Flags
--docs : Opens the documentation for azd auth in your web browser.
-h, --help : Gets help for auth.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd auth in your web browser.
-h, --help : Gets help for auth.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Use azd auth [command] --help to view examples and more information about a specific command.
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-config-get.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ Gets a configuration.
Usage
azd config get <path> [flags]

Flags
--docs : Opens the documentation for azd config get in your web browser.
-h, --help : Gets help for get.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd config get in your web browser.
-h, --help : Gets help for get.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-config-list-alpha.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ Display the list of available features in alpha stage.
Usage
azd config list-alpha [flags]

Flags
--docs : Opens the documentation for azd config list-alpha in your web browser.
-h, --help : Gets help for list-alpha.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd config list-alpha in your web browser.
-h, --help : Gets help for list-alpha.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Examples
Expand Down
4 changes: 2 additions & 2 deletions cli/azd/cmd/testdata/TestUsage-azd-config-reset.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Usage
azd config reset [flags]

Flags
--docs : Opens the documentation for azd config reset in your web browser.
-f, --force : Force reset without confirmation.
-h, --help : Gets help for reset.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd config reset in your web browser.
-h, --help : Gets help for reset.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-config-set.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ Sets a configuration.
Usage
azd config set <path> <value> [flags]

Flags
--docs : Opens the documentation for azd config set in your web browser.
-h, --help : Gets help for set.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd config set in your web browser.
-h, --help : Gets help for set.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-config-show.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ Show all the configuration values.
Usage
azd config show [flags]

Flags
--docs : Opens the documentation for azd config show in your web browser.
-h, --help : Gets help for show.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd config show in your web browser.
-h, --help : Gets help for show.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-config-unset.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ Unsets a configuration.
Usage
azd config unset <path> [flags]

Flags
--docs : Opens the documentation for azd config unset in your web browser.
-h, --help : Gets help for unset.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd config unset in your web browser.
-h, --help : Gets help for unset.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-config.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ Available Commands
show : Show all the configuration values.
unset : Unsets a configuration.

Flags
--docs : Opens the documentation for azd config in your web browser.
-h, --help : Gets help for config.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd config in your web browser.
-h, --help : Gets help for config.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Use azd config [command] --help to view examples and more information about a specific command.
Expand Down
4 changes: 2 additions & 2 deletions cli/azd/cmd/testdata/TestUsage-azd-deploy.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Usage

Flags
--all : Deploys all services that are listed in azure.yaml
--docs : Opens the documentation for azd deploy in your web browser.
-e, --environment string : The name of the environment to use.
--from-package string : Deploys the application from an existing package.
-h, --help : Gets help for deploy.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd deploy in your web browser.
-h, --help : Gets help for deploy.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Examples
Expand Down
4 changes: 2 additions & 2 deletions cli/azd/cmd/testdata/TestUsage-azd-down.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Usage
azd down [flags]

Flags
--docs : Opens the documentation for azd down in your web browser.
-e, --environment string : The name of the environment to use.
--force : Does not require confirmation before it deletes resources.
-h, --help : Gets help for down.
--purge : Does not require confirmation before it permanently deletes resources that are soft-deleted by default (for example, key vaults).

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd down in your web browser.
-h, --help : Gets help for down.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Examples
Expand Down
4 changes: 2 additions & 2 deletions cli/azd/cmd/testdata/TestUsage-azd-env-get-value.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Usage
azd env get-value <keyName> [flags]

Flags
--docs : Opens the documentation for azd env get-value in your web browser.
-e, --environment string : The name of the environment to use.
-h, --help : Gets help for get-value.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd env get-value in your web browser.
-h, --help : Gets help for get-value.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
4 changes: 2 additions & 2 deletions cli/azd/cmd/testdata/TestUsage-azd-env-get-values.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Usage
azd env get-values [flags]

Flags
--docs : Opens the documentation for azd env get-values in your web browser.
-e, --environment string : The name of the environment to use.
-h, --help : Gets help for get-values.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd env get-values in your web browser.
-h, --help : Gets help for get-values.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-env-list.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ List environments.
Usage
azd env list [flags]

Flags
--docs : Opens the documentation for azd env list in your web browser.
-h, --help : Gets help for list.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd env list in your web browser.
-h, --help : Gets help for list.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
4 changes: 2 additions & 2 deletions cli/azd/cmd/testdata/TestUsage-azd-env-new.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Usage
azd env new <environment> [flags]

Flags
--docs : Opens the documentation for azd env new in your web browser.
-h, --help : Gets help for new.
-l, --location string : Azure location for the new environment
--subscription string : Name or ID of an Azure subscription to use for the new environment

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd env new in your web browser.
-h, --help : Gets help for new.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
4 changes: 2 additions & 2 deletions cli/azd/cmd/testdata/TestUsage-azd-env-refresh.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Usage
azd env refresh <environment> [flags]

Flags
--docs : Opens the documentation for azd env refresh in your web browser.
-e, --environment string : The name of the environment to use.
-h, --help : Gets help for refresh.
--hint string : Hint to help identify the environment to refresh

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd env refresh in your web browser.
-h, --help : Gets help for refresh.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-env-select.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ Set the default environment.
Usage
azd env select <environment> [flags]

Flags
--docs : Opens the documentation for azd env select in your web browser.
-h, --help : Gets help for select.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd env select in your web browser.
-h, --help : Gets help for select.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
4 changes: 2 additions & 2 deletions cli/azd/cmd/testdata/TestUsage-azd-env-set.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Usage
azd env set <key> <value> [flags]

Flags
--docs : Opens the documentation for azd env set in your web browser.
-e, --environment string : The name of the environment to use.
-h, --help : Gets help for set.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd env set in your web browser.
-h, --help : Gets help for set.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Find a bug? Want to let us know how we're doing? Fill out this brief survey: https://aka.ms/azure-dev/hats.
Expand Down
6 changes: 2 additions & 4 deletions cli/azd/cmd/testdata/TestUsage-azd-env.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ Available Commands
select : Set the default environment.
set : Manage your environment settings.

Flags
--docs : Opens the documentation for azd env in your web browser.
-h, --help : Gets help for env.

Global Flags
-C, --cwd string : Sets the current working directory.
--debug : Enables debugging and diagnostics logging.
--docs : Opens the documentation for azd env in your web browser.
-h, --help : Gets help for env.
--no-prompt : Accepts the default value instead of prompting, or it fails if there is no default.

Use azd env [command] --help to view examples and more information about a specific command.
Expand Down
Loading

0 comments on commit 94ee21b

Please sign in to comment.