Comparing version 0.6.8 to 0.6.9
@@ -5,7 +5,7 @@ /** | ||
*/ | ||
export declare const ExistingPath: Pick<import("..").Type<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
export declare const ExistingPath: Omit<import("..").Type<string, string>, "from" | "defaultValue"> & Omit<{ | ||
displayName: string; | ||
description: string; | ||
from(str: string): Promise<string>; | ||
}, "description" | "displayName"> & import("../from").From<string, string>; | ||
}, "from"> & import("../from").From<string, string>; | ||
/** | ||
@@ -15,22 +15,22 @@ * Resolves to a directory if given one, and to a file's directory if file was given. | ||
*/ | ||
export declare const Directory: Pick<Pick<import("..").Type<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
export declare const Directory: Omit<Omit<import("..").Type<string, string>, "from" | "defaultValue"> & Omit<{ | ||
displayName: string; | ||
description: string; | ||
from(str: string): Promise<string>; | ||
}, "description" | "displayName"> & import("../from").From<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
}, "from"> & import("../from").From<string, string>, "from" | "defaultValue"> & Omit<{ | ||
from(resolved: string): Promise<string>; | ||
displayName: string; | ||
description: string; | ||
}, "description" | "displayName"> & import("../from").From<string, string>; | ||
}, "from"> & import("../from").From<string, string>; | ||
/** | ||
* Resolves to a path to an existing file | ||
*/ | ||
export declare const File: Pick<Pick<import("..").Type<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
export declare const File: Omit<Omit<import("..").Type<string, string>, "from" | "defaultValue"> & Omit<{ | ||
displayName: string; | ||
description: string; | ||
from(str: string): Promise<string>; | ||
}, "description" | "displayName"> & import("../from").From<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
}, "from"> & import("../from").From<string, string>, "from" | "defaultValue"> & Omit<{ | ||
from(resolved: string): Promise<string>; | ||
displayName: string; | ||
description: string; | ||
}, "description" | "displayName"> & import("../from").From<string, string>; | ||
}, "from"> & import("../from").From<string, string>; |
@@ -6,16 +6,16 @@ /// <reference types="node" /> | ||
*/ | ||
export declare const Url: Pick<import("..").Type<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
export declare const Url: Omit<import("..").Type<string, string>, "from" | "defaultValue"> & Omit<{ | ||
displayName: string; | ||
description: string; | ||
from(str: string): Promise<URL>; | ||
}, "description" | "displayName"> & import("../from").From<string, URL>; | ||
}, "from"> & import("../from").From<string, URL>; | ||
/** | ||
* Decodes an http/https only URL | ||
*/ | ||
export declare const HttpUrl: Pick<Pick<import("..").Type<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
export declare const HttpUrl: Omit<Omit<import("..").Type<string, string>, "from" | "defaultValue"> & Omit<{ | ||
displayName: string; | ||
description: string; | ||
from(str: string): Promise<URL>; | ||
}, "description" | "displayName"> & import("../from").From<string, URL>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
}, "from"> & import("../from").From<string, URL>, "from" | "defaultValue"> & Omit<{ | ||
from(url: URL): Promise<URL>; | ||
}, never> & import("../from").From<string, URL>; | ||
}, "from"> & import("../from").From<string, URL>; |
@@ -6,6 +6,6 @@ import { ArgParser, Register, ParseContext } from './argparser'; | ||
export declare const helpFlag: Partial<Register> & { | ||
parse(context: ParseContext): Promise<Result.Result<import("./argparser").FailedParse, boolean>>; | ||
parse(context: ParseContext): Promise<import("./argparser").ParsingResult<boolean>>; | ||
} & ProvidesHelp & Register & Partial<import("./helpdoc").Descriptive>; | ||
export declare const versionFlag: Partial<Register> & { | ||
parse(context: ParseContext): Promise<Result.Result<import("./argparser").FailedParse, boolean>>; | ||
parse(context: ParseContext): Promise<import("./argparser").ParsingResult<boolean>>; | ||
} & ProvidesHelp & Register & Partial<import("./helpdoc").Descriptive>; | ||
@@ -12,0 +12,0 @@ export declare function handleCircuitBreaker(context: ParseContext, value: PrintHelp & Partial<Versioned>, breaker: Result.Result<any, CircuitBreaker>): void; |
@@ -20,1 +20,5 @@ import { Type, InputOf, OutputOf } from './type'; | ||
export declare function optional<T extends Type<any, any>>(t: T): Type<InputOf<T>, OutputOf<T> | undefined>; | ||
/** | ||
* Transforms any type into an array, useful for `multioption` and `multiflag`. | ||
*/ | ||
export declare function array<T extends Type<any, any>>(t: T): Type<InputOf<T>[], OutputOf<T>[]>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.optional = exports.boolean = exports.string = exports.number = void 0; | ||
exports.array = exports.optional = exports.boolean = exports.string = exports.number = void 0; | ||
const type_1 = require("./type"); | ||
@@ -12,3 +12,3 @@ /** | ||
async from(str) { | ||
const decoded = parseInt(str, 10); | ||
const decoded = parseFloat(str); | ||
if (Number.isNaN(decoded)) { | ||
@@ -55,2 +55,14 @@ throw new Error('Not a number'); | ||
exports.optional = optional; | ||
/** | ||
* Transforms any type into an array, useful for `multioption` and `multiflag`. | ||
*/ | ||
function array(t) { | ||
return { | ||
...t, | ||
async from(inputs) { | ||
return Promise.all(inputs.map((input) => t.from(input))); | ||
}, | ||
}; | ||
} | ||
exports.array = array; | ||
//# sourceMappingURL=types.js.map |
@@ -5,7 +5,7 @@ /** | ||
*/ | ||
export declare const ExistingPath: Pick<import("..").Type<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
export declare const ExistingPath: Omit<import("..").Type<string, string>, "from" | "defaultValue"> & Omit<{ | ||
displayName: string; | ||
description: string; | ||
from(str: string): Promise<string>; | ||
}, "description" | "displayName"> & import("../from").From<string, string>; | ||
}, "from"> & import("../from").From<string, string>; | ||
/** | ||
@@ -15,22 +15,22 @@ * Resolves to a directory if given one, and to a file's directory if file was given. | ||
*/ | ||
export declare const Directory: Pick<Pick<import("..").Type<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
export declare const Directory: Omit<Omit<import("..").Type<string, string>, "from" | "defaultValue"> & Omit<{ | ||
displayName: string; | ||
description: string; | ||
from(str: string): Promise<string>; | ||
}, "description" | "displayName"> & import("../from").From<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
}, "from"> & import("../from").From<string, string>, "from" | "defaultValue"> & Omit<{ | ||
from(resolved: string): Promise<string>; | ||
displayName: string; | ||
description: string; | ||
}, "description" | "displayName"> & import("../from").From<string, string>; | ||
}, "from"> & import("../from").From<string, string>; | ||
/** | ||
* Resolves to a path to an existing file | ||
*/ | ||
export declare const File: Pick<Pick<import("..").Type<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
export declare const File: Omit<Omit<import("..").Type<string, string>, "from" | "defaultValue"> & Omit<{ | ||
displayName: string; | ||
description: string; | ||
from(str: string): Promise<string>; | ||
}, "description" | "displayName"> & import("../from").From<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
}, "from"> & import("../from").From<string, string>, "from" | "defaultValue"> & Omit<{ | ||
from(resolved: string): Promise<string>; | ||
displayName: string; | ||
description: string; | ||
}, "description" | "displayName"> & import("../from").From<string, string>; | ||
}, "from"> & import("../from").From<string, string>; |
@@ -6,16 +6,16 @@ /// <reference types="node" /> | ||
*/ | ||
export declare const Url: Pick<import("..").Type<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
export declare const Url: Omit<import("..").Type<string, string>, "from" | "defaultValue"> & Omit<{ | ||
displayName: string; | ||
description: string; | ||
from(str: string): Promise<URL>; | ||
}, "description" | "displayName"> & import("../from").From<string, URL>; | ||
}, "from"> & import("../from").From<string, URL>; | ||
/** | ||
* Decodes an http/https only URL | ||
*/ | ||
export declare const HttpUrl: Pick<Pick<import("..").Type<string, string>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
export declare const HttpUrl: Omit<Omit<import("..").Type<string, string>, "from" | "defaultValue"> & Omit<{ | ||
displayName: string; | ||
description: string; | ||
from(str: string): Promise<URL>; | ||
}, "description" | "displayName"> & import("../from").From<string, URL>, "description" | "displayName" | "defaultValueIsSerializable"> & Pick<{ | ||
}, "from"> & import("../from").From<string, URL>, "from" | "defaultValue"> & Omit<{ | ||
from(url: URL): Promise<URL>; | ||
}, never> & import("../from").From<string, URL>; | ||
}, "from"> & import("../from").From<string, URL>; |
@@ -6,6 +6,6 @@ import { ArgParser, Register, ParseContext } from './argparser'; | ||
export declare const helpFlag: Partial<Register> & { | ||
parse(context: ParseContext): Promise<Result.Result<import("./argparser").FailedParse, boolean>>; | ||
parse(context: ParseContext): Promise<import("./argparser").ParsingResult<boolean>>; | ||
} & ProvidesHelp & Register & Partial<import("./helpdoc").Descriptive>; | ||
export declare const versionFlag: Partial<Register> & { | ||
parse(context: ParseContext): Promise<Result.Result<import("./argparser").FailedParse, boolean>>; | ||
parse(context: ParseContext): Promise<import("./argparser").ParsingResult<boolean>>; | ||
} & ProvidesHelp & Register & Partial<import("./helpdoc").Descriptive>; | ||
@@ -12,0 +12,0 @@ export declare function handleCircuitBreaker(context: ParseContext, value: PrintHelp & Partial<Versioned>, breaker: Result.Result<any, CircuitBreaker>): void; |
@@ -20,1 +20,5 @@ import { Type, InputOf, OutputOf } from './type'; | ||
export declare function optional<T extends Type<any, any>>(t: T): Type<InputOf<T>, OutputOf<T> | undefined>; | ||
/** | ||
* Transforms any type into an array, useful for `multioption` and `multiflag`. | ||
*/ | ||
export declare function array<T extends Type<any, any>>(t: T): Type<InputOf<T>[], OutputOf<T>[]>; |
@@ -9,3 +9,3 @@ import { identity } from './type'; | ||
async from(str) { | ||
const decoded = parseInt(str, 10); | ||
const decoded = parseFloat(str); | ||
if (Number.isNaN(decoded)) { | ||
@@ -51,2 +51,13 @@ throw new Error('Not a number'); | ||
} | ||
/** | ||
* Transforms any type into an array, useful for `multioption` and `multiflag`. | ||
*/ | ||
export function array(t) { | ||
return { | ||
...t, | ||
async from(inputs) { | ||
return Promise.all(inputs.map((input) => t.from(input))); | ||
}, | ||
}; | ||
} | ||
//# sourceMappingURL=types.js.map |
{ | ||
"name": "cmd-ts", | ||
"version": "0.6.8", | ||
"version": "0.6.9", | ||
"homepage": "https://cmd-ts.now.sh", | ||
@@ -42,16 +42,16 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@swc-node/jest": "1.0.3", | ||
"@swc-node/register": "1.0.3", | ||
"@swc-node/jest": "1.1.1", | ||
"@swc-node/register": "1.0.5", | ||
"@types/debug": "4.1.5", | ||
"@types/didyoumean": "1.2.0", | ||
"@types/fs-extra": "9.0.6", | ||
"@types/jest": "26.0.19", | ||
"@types/node-fetch": "2.5.7", | ||
"@types/fs-extra": "9.0.8", | ||
"@types/jest": "26.0.20", | ||
"@types/node-fetch": "2.5.8", | ||
"@types/request": "2.48.5", | ||
"@typescript-eslint/eslint-plugin": "4.12.0", | ||
"@typescript-eslint/parser": "4.12.0", | ||
"@typescript-eslint/eslint-plugin": "4.16.1", | ||
"@typescript-eslint/parser": "4.16.1", | ||
"cargo-mdbook": "0.4.4", | ||
"docs-ts": "0.5.3", | ||
"eslint": "7.17.0", | ||
"eslint-config-prettier": "7.1.0", | ||
"docs-ts": "0.6.4", | ||
"eslint": "7.21.0", | ||
"eslint-config-prettier": "7.2.0", | ||
"eslint-plugin-import": "2.22.1", | ||
@@ -61,4 +61,4 @@ "eslint-plugin-prettier": "3.3.1", | ||
"execa": "5.0.0", | ||
"fs-extra": "9.0.1", | ||
"husky": "4.3.6", | ||
"fs-extra": "9.1.0", | ||
"husky": "5.1.3", | ||
"infer-types": "0.0.2", | ||
@@ -71,6 +71,6 @@ "jest": "26.6.3", | ||
"tempy": "1.0.0", | ||
"typedoc": "0.20.12", | ||
"typescript": "4.1.3" | ||
"typedoc": "0.20.30", | ||
"typescript": "4.2.3" | ||
}, | ||
"peerDependencies": {} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
369384
210
7310