Add explicit login/logout flows and browser selection
This commit is contained in:
28
src/cli.js
28
src/cli.js
@@ -16,6 +16,8 @@ function usage() {
|
||||
return `Usage: sk-az-tools <command> [options]
|
||||
|
||||
Commands:
|
||||
login Authenticate selected resources
|
||||
logout Sign out and clear login state
|
||||
list-apps List Entra applications
|
||||
list-app-permissions List required permissions for an app
|
||||
list-app-grants List OAuth2 grants for an app
|
||||
@@ -40,6 +42,23 @@ Options:
|
||||
-f, --filter <glob> Filter by app display name glob`;
|
||||
}
|
||||
|
||||
function usageLogin() {
|
||||
return `Usage: sk-az-tools login [--resources <csv>] [--use-device-code] [--no-browser] [--browser <name>] [global options]
|
||||
|
||||
Options:
|
||||
--resources <csv> Comma-separated resources: graph,devops,arm (default: all)
|
||||
--use-device-code Use device code flow instead of interactive flow
|
||||
--no-browser Do not launch browser; print interactive URL to stderr
|
||||
--browser <name> Browser keyword: default|brave|browser|browserPrivate|chrome|edge|firefox`;
|
||||
}
|
||||
|
||||
function usageLogout() {
|
||||
return `Usage: sk-az-tools logout [--all] [global options]
|
||||
|
||||
Options:
|
||||
--all Clear login state and remove all cached accounts`;
|
||||
}
|
||||
|
||||
function usageListAppPermissions() {
|
||||
return `Usage: sk-az-tools list-app-permissions --app-id|-i <appId> [--resolve|-r] [--short|-s] [--filter|-f <glob>] [global options]
|
||||
|
||||
@@ -75,8 +94,12 @@ Options:
|
||||
|
||||
function usageCommand(command) {
|
||||
switch (command) {
|
||||
case "login":
|
||||
return usageLogin();
|
||||
case "list-apps":
|
||||
return usageListApps();
|
||||
case "logout":
|
||||
return usageLogout();
|
||||
case "list-app-permissions":
|
||||
return usageListAppPermissions();
|
||||
case "list-app-grants":
|
||||
@@ -109,6 +132,11 @@ async function main() {
|
||||
help: { type: "boolean", short: "h" },
|
||||
"display-name": { type: "string", short: "n" },
|
||||
"app-id": { type: "string", short: "i" },
|
||||
resources: { type: "string" },
|
||||
"use-device-code": { type: "boolean" },
|
||||
"no-browser": { type: "boolean" },
|
||||
browser: { type: "string" },
|
||||
all: { type: "boolean" },
|
||||
resolve: { type: "boolean", short: "r" },
|
||||
short: { type: "boolean", short: "s" },
|
||||
filter: { type: "string", short: "f" },
|
||||
|
||||
Reference in New Issue
Block a user