44 "context"
55 "errors"
66 "fmt"
7+ "slices"
78 "strings"
89
910 "github.com/databricks/cli/libs/cmdio"
@@ -12,6 +13,7 @@ import (
1213 "github.com/databricks/cli/libs/env"
1314 "github.com/databricks/cli/libs/log"
1415 "github.com/databricks/databricks-sdk-go/credentials/u2m/cache"
16+ "github.com/manifoldco/promptui"
1517 "github.com/spf13/cobra"
1618)
1719
@@ -45,7 +47,33 @@ This command removes the specified profile from %s and deletes
4547any associated cached OAuth tokens.
4648
4749You will need to run "databricks auth login" to re-authenticate after
48- logging out.` , configPath ),
50+ logging out.
51+
52+ This command requires a profile to be specified (using --profile). If you
53+ omit --profile and run in an interactive terminal, you'll be shown an
54+ interactive profile picker to select which profile to log out of.
55+
56+ While this command always removes the specified profile, the runtime behaviour
57+ depends on whether you run it in an interactive terminal and which flags you
58+ provide.
59+
60+ 1. If you specify --profile, the command will log out of that profile.
61+ In an interactive terminal, you'll be asked to confirm unless --force
62+ is specified.
63+
64+ 2. If you omit --profile and run in an interactive terminal, you'll be shown
65+ an interactive picker listing all profiles from your configuration file.
66+ Profiles are sorted alphabetically by name. You can search by profile
67+ name, host, or account ID. After selecting a profile, you'll be asked to
68+ confirm unless --force is specified.
69+
70+ 3. If you omit --profile and run in a non-interactive environment (e.g.
71+ CI/CD pipelines), the command will fail with an error asking you to
72+ specify --profile.
73+
74+ 4. Use --force to skip the confirmation prompt. This is required when
75+ running in non-interactive mode; otherwise the command will fail.` ,
76+ configPath ),
4977 }
5078
5179 var force bool
0 commit comments