aspargvs
Version:
Parse argv as json object
32 lines (31 loc) • 1 kB
TypeScript
import * as p from 'peberminta';
import { JsonArray, JsonObject, JsonValue, JsonPrimitive } from './json';
import { ArgToken, ArrayPath, ObjectPath } from './key-token-parser';
import { Options } from './options';
export declare type ArraySubKeyValue = {
path: ArrayPath;
value: JsonValue;
};
export declare type ObjectSubKeyValue = {
path: ObjectPath;
value: JsonValue;
};
export declare type ArrayKeyValue = {
type: 'arrayKeyValue';
path: ObjectPath;
value: JsonArray;
subs: ArraySubKeyValue[];
};
export declare type ObjectKeyValue = {
type: 'objectKeyValue';
path: ObjectPath;
value: JsonObject;
subs: ObjectSubKeyValue[];
};
export declare type PrimitiveKeyValue = {
type: 'primitiveKeyValue';
path: ObjectPath;
value: JsonPrimitive;
};
export declare type KeyValueResult = PrimitiveKeyValue | ArrayKeyValue | ObjectKeyValue;
export declare const parseAllKeys: p.Matcher<ArgToken, Options, KeyValueResult[]>;