Migrated from parseArgs from node:util to commander.js.
All checks were successful
build / build (push) Successful in 14s
All checks were successful
build / build (push) Successful in 14s
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
|
||||
import { listAppGrants } from "../../graph/app.ts";
|
||||
import { getGraphClient } from "../../graph/index.ts";
|
||||
import type { CommandValues } from "./types.ts";
|
||||
|
||||
type ListAppGrantsOptions = {
|
||||
appId?: string;
|
||||
};
|
||||
|
||||
export function usageListAppGrants(): string {
|
||||
return `Usage: sk-az-tools list-app-grants --app-id|-i <appId> [global options]
|
||||
@@ -11,11 +14,11 @@ Options:
|
||||
--app-id, -i <appId> Application (client) ID (required)`;
|
||||
}
|
||||
|
||||
export async function runListAppGrantsCommand(values: CommandValues): Promise<unknown> {
|
||||
if (!values["app-id"]) {
|
||||
export async function runListAppGrantsCommand(options: ListAppGrantsOptions): Promise<unknown> {
|
||||
if (!options.appId) {
|
||||
throw new Error("--app-id is required for list-app-grants");
|
||||
}
|
||||
|
||||
const client = await getGraphClient();
|
||||
return listAppGrants(client, values["app-id"]);
|
||||
return listAppGrants(client, options.appId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user