gen-flags: Args.required reads are flags too (edit --ops, privacy-manifest --ios, apple listing --version were refused as unknown options); play games client listAll (no false flags)
This commit is contained in:
parent
d427b5c4a4
commit
567d6ca181
3 changed files with 15 additions and 19 deletions
|
|
@ -2,7 +2,7 @@
|
|||
// Writes cli/data/flags.json: the --flags every command accepts, so the dispatcher (cli/index.ts) can reject an
|
||||
// unknown flag (a typo like --dyr) with the usage before anything runs, also in the compiled sidecar (no sources).
|
||||
// For each command in cli/commands.ts it follows the command module and every local module it imports (static and
|
||||
// dynamic), and collects the literal flag reads: <x>.has('name'), .get, .str, .num, .list, .many. Reads with a computed
|
||||
// dynamic), and collects the literal flag reads: <x>.has('name'), .get, .str, .num, .list, .many, .required. Reads with a computed
|
||||
// name are listed in DYNAMIC below (the scan fails on a new one until it is added there). `ws` forwards its flags to the
|
||||
// command it runs, so it accepts every flag. GLOBAL flags work on every command. The usage lines of each module's
|
||||
// header comment (`// storebound <command> ...`) go along, for `storebound <command> --help`.
|
||||
|
|
@ -31,9 +31,9 @@ const DYNAMIC: Record<string, string[]> = {
|
|||
const FORWARDS = new Set(['ws']);
|
||||
|
||||
// the receiver is captured so HTTP headers and URL search params (res.headers.get('content-type')) are not flags
|
||||
const READ = /([\w$.)\]]*)\.(?:has|get|str|num|list|many)\(\s*(['"])([a-z][a-z0-9-]*)\2/g;
|
||||
const READ = /([\w$.)\]]*)\.(?:has|get|str|num|list|many|required)\(\s*(['"])([a-z][a-z0-9-]*)\2/g;
|
||||
const NOT_ARGS = /(?:headers|searchParams|params|url|env)$/i;
|
||||
const COMPUTED = /\b(?:args|a|ctx\.args)\.(?:has|get|str|num|list|many)\(\s*(?![\s'"])/g;
|
||||
const COMPUTED = /\b(?:args|a|ctx\.args)\.(?:has|get|str|num|list|many|required)\(\s*(?![\s'"])/g;
|
||||
const IMPORT = /(?:\bfrom\s+|\bimport\s*\(\s*)'(\.{1,2}\/[^']+)'/g;
|
||||
|
||||
function file(spec: string, from: string): string | null {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue