Migrated from parseArgs from node:util to commander.js.
All checks were successful
build / build (push) Successful in 14s

This commit is contained in:
2026-03-10 07:15:00 +01:00
parent a98c77cd2e
commit 9fd770999b
12 changed files with 220 additions and 242 deletions

View File

@@ -3,7 +3,13 @@
import { login } from "../../azure/index.ts";
import { loadAuthConfig } from "../../index.ts";
import type { CommandValues } from "./types.ts";
type LoginOptions = {
resources?: string;
useDeviceCode?: boolean;
noBrowser?: boolean;
browser?: string;
browserProfile?: string;
};
export function usageLogin(): string {
return `Usage: sk-az-tools login [--resources <csv>] [--use-device-code] [--no-browser] [--browser <name>] [--browser-profile <profile>] [global options]
@@ -16,15 +22,15 @@ Options:
--browser-profile <name> Chromium profile name (e.g. Default, "Profile 1")`;
}
export async function runLoginCommand(values: CommandValues): Promise<unknown> {
export async function runLoginCommand(options: LoginOptions): Promise<unknown> {
const config = await loadAuthConfig("public-config");
return login(
config.tenantId,
config.clientId,
values.resources,
Boolean(values["use-device-code"]),
Boolean(values["no-browser"]),
values.browser,
values["browser-profile"],
options.resources,
Boolean(options.useDeviceCode),
Boolean(options.noBrowser),
options.browser,
options.browserProfile,
);
}