forked from ericc-ch/copilot-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth-remove.ts
More file actions
52 lines (47 loc) · 1.06 KB
/
auth-remove.ts
File metadata and controls
52 lines (47 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { defineCommand } from "citty"
import consola from "consola"
import { removeAccountEntry } from "./lib/accounts-loader"
import { ensurePaths } from "./lib/paths"
interface RunAuthRemoveOptions {
name: string
verbose: boolean
}
export async function runAuthRemove(
options: RunAuthRemoveOptions,
): Promise<void> {
if (options.verbose) {
consola.level = 5
}
await ensurePaths()
const removed = await removeAccountEntry(options.name)
if (!removed) {
consola.warn(`Account "${options.name}" not found`)
process.exitCode = 1
}
}
export const authRemove = defineCommand({
meta: {
name: "remove",
description: "Remove a GitHub account by name",
},
args: {
name: {
alias: "n",
type: "string",
required: true,
description: "Name of the account to remove",
},
verbose: {
alias: "v",
type: "boolean",
default: false,
description: "Enable verbose logging",
},
},
run({ args }) {
return runAuthRemove({
name: args.name,
verbose: args.verbose,
})
},
})