1import { AuthGrantScope } from "@t3tools/contracts";
2import { Flag } from "effect/cli";
3
4export const authScopesFlag = (defaults: ReadonlyArray<AuthGrantScope>) =>
5 Flag.Literals("scope", AuthGrantScope.literals).pipe(
6 Flag.withDescription(
7 `Authorization scope to grant. Repeat for multiple scopes; replaces the default set: ${defaults.join(", ")}.`,
8 ),
9 Flag.atLeast(0),
10 Flag.map((scopes) => [...new Set(scopes.length > 0 ? scopes : defaults)]),
11 );