MCPcopy
hub / github.com/marktext/marktext / parseArgs

Function parseArgs

packages/desktop/src/main/cli/parser.ts:10–33  ·  view source on GitHub ↗
(argv: string[] | null = null, permissive: boolean = true)

Source from the content-addressed store, hash-verified

8 * @returns Parsed arguments
9 */
10const parseArgs = (argv: string[] | null = null, permissive: boolean = true) => {
11 if (argv === null) {
12 argv = process.argv.slice(1)
13 }
14 const spec = {
15 '--debug': Boolean,
16 '--safe': Boolean,
17
18 '--new-window': Boolean,
19 '-n': '--new-window',
20
21 '--disable-gpu': Boolean,
22 '--disable-spellcheck': Boolean,
23 '--user-data-dir': String,
24
25 // Misc
26 '--help': Boolean,
27 '-h': '--help',
28 '--verbose': arg.COUNT,
29 '-v': '--verbose',
30 '--version': Boolean
31 } satisfies arg.Spec
32 return arg(spec, { argv, permissive })
33}
34
35export type ParsedArgs = ReturnType<typeof parseArgs>
36

Callers 2

cliFunction · 0.85
initMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected