dropsh 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loginCapableProviders, providerById } from "../core/auth/registry.js";
|
|
1
|
+
import { defaultProvider, loginCapableProviders, providerById } from "../core/auth/registry.js";
|
|
2
2
|
import { clearAll, clearProfile, readProfiles, setActive, writeProfile, } from "../core/auth/session-store.js";
|
|
3
3
|
import { AuthError, ConfigError } from "../errors.js";
|
|
4
4
|
function authContext(deps) {
|
|
@@ -24,6 +24,12 @@ async function pickProvider(deps, requestedId) {
|
|
|
24
24
|
throw new ConfigError(`unknown provider '${requestedId}'. Available: ${capable.map((p) => p.id).join(", ")}`);
|
|
25
25
|
return found;
|
|
26
26
|
}
|
|
27
|
+
// No explicit --provider: fall back to the configured default profile
|
|
28
|
+
// (default: true), or the sole provider. Only then, if still ambiguous and
|
|
29
|
+
// interactive, prompt; non-interactive with no default stays an error.
|
|
30
|
+
const fallback = defaultProvider(capable) ?? (capable.length === 1 ? capable[0] : undefined);
|
|
31
|
+
if (fallback)
|
|
32
|
+
return fallback;
|
|
27
33
|
if (!deps.isTTY)
|
|
28
34
|
throw new ConfigError("non-interactive: pass --provider <id>");
|
|
29
35
|
deps.stdout("Select an auth provider:\n");
|