Skip to content
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
6 changes: 6 additions & 0 deletions cli/azd/.vscode/cspell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ overrides:
- userosscache
- docstates
- dylib
- filename: docs/recording-functional-tests-guide.md
words:
- httptest
- Logf
- Getenv
- httptest
ignorePaths:
- "**/*_test.go"
- "**/mock*.go"
Expand Down
35 changes: 0 additions & 35 deletions cli/azd/cmd/auth_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,6 @@ func (lf *loginFlags) Bind(local *pflag.FlagSet, global *internal.GlobalCommandO
lf.global = global
}

func newLoginFlags(cmd *cobra.Command, global *internal.GlobalCommandOptions) *loginFlags {
flags := &loginFlags{}
flags.Bind(cmd.Flags(), global)

return flags
}

func newLoginCmd(parent string) *cobra.Command {
return &cobra.Command{
Use: "login",
Expand Down Expand Up @@ -237,9 +230,6 @@ type loginAction struct {
commandRunner exec.CommandRunner
}

// it is important to update both newAuthLoginAction and newLoginAction at the same time
// newAuthLoginAction is the action that is bound to `azd auth login`,
// and newLoginAction is the action that is bound to `azd login`
func newAuthLoginAction(
formatter output.Formatter,
writer io.Writer,
Expand All @@ -262,31 +252,6 @@ func newAuthLoginAction(
}
}

// it is important to update both newAuthLoginAction and newLoginAction at the same time
// newAuthLoginAction is the action that is bound to `azd auth login`,
// and newLoginAction is the action that is bound to `azd login`
func newLoginAction(
formatter output.Formatter,
writer io.Writer,
authManager *auth.Manager,
accountSubManager *account.SubscriptionsManager,
flags *loginFlags,
console input.Console,
annotations CmdAnnotations,
commandRunner exec.CommandRunner,
) actions.Action {
return &loginAction{
formatter: formatter,
writer: writer,
console: console,
authManager: authManager,
accountSubManager: accountSubManager,
flags: flags,
annotations: annotations,
commandRunner: commandRunner,
}
}

func (la *loginAction) Run(ctx context.Context) (*actions.ActionResult, error) {
if len(la.flags.scopes) == 0 {
la.flags.scopes = la.authManager.LoginScopes()
Expand Down
12 changes: 12 additions & 0 deletions cli/azd/cmd/auto_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,18 @@ func ExecuteWithAutoInstall(ctx context.Context, rootContainer *ioc.NestedContai
log.Panic("failed to resolve console for unknown flags error:", err)
}

// Check for deprecated commands and provide helpful redirection messages
if unknownCommand == "login" {
console.Message(ctx, "Error: The 'azd login' command has been removed.")
console.Message(ctx, "Please use 'azd auth login' instead.")
return fmt.Errorf("unknown command 'login'")
}
if unknownCommand == "logout" {
console.Message(ctx, "Error: The 'azd logout' command has been removed.")
console.Message(ctx, "Please use 'azd auth logout' instead.")
return fmt.Errorf("unknown command 'logout'")
}

// If unknown flags were found before a non-built-in command, return an error with helpful guidance
if len(unknownFlags) > 0 {
flagsList := strings.Join(unknownFlags, ", ")
Expand Down
Loading
Loading