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