mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Create types for sade (#40398)
This commit is contained in:
parent
6061d28041
commit
a2149e0650
33
types/sade/index.d.ts
vendored
Normal file
33
types/sade/index.d.ts
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
// Type definitions for sade 1.6
|
||||
// Project: https://github.com/lukeed/sade#readme
|
||||
// Definitions by: Epimodev <https://github.com/Epimodev>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as mri from 'mri';
|
||||
|
||||
type Handler = (...args: any[]) => void;
|
||||
|
||||
declare namespace sade {
|
||||
interface CommandOptions {
|
||||
default?: boolean;
|
||||
}
|
||||
|
||||
interface ParseOptions extends mri.Options {
|
||||
lazy?: boolean;
|
||||
}
|
||||
|
||||
interface Sade {
|
||||
command(str: string, desc?: string, opts?: Readonly<CommandOptions>): Sade;
|
||||
describe(str: string | ReadonlyArray<string>): Sade;
|
||||
option(str: string, desc: string, val?: string | number): Sade;
|
||||
action(handler: Handler): Sade;
|
||||
example(str: string): Sade;
|
||||
version(str: string): Sade;
|
||||
parse(arr: string[], opts?: Readonly<ParseOptions>): { args: string[]; name: string; handler: Handler } | void;
|
||||
help(str: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare function sade(str: string, isOne?: boolean): sade.Sade;
|
||||
|
||||
export = sade;
|
||||
20
types/sade/sade-tests.ts
Normal file
20
types/sade/sade-tests.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import sade = require('sade');
|
||||
|
||||
const prog = sade('my-cli');
|
||||
|
||||
const argv = ['sirv', 'build'];
|
||||
|
||||
prog.version('1.0.5')
|
||||
.option('--global, -g', 'An example global flag')
|
||||
.option('-c, --config', 'Provide path to custom config', 'foo.config.js');
|
||||
|
||||
prog.command('build <src> <dest>')
|
||||
.describe('Build the source directory. Expects an `index.js` entry file.')
|
||||
.option('-o, --output', 'Change the name of the output file', 'bundle.js')
|
||||
.example('build src build --global --config my-conf.js')
|
||||
.example('build app public -o main.js')
|
||||
.action((src: any, dest: any, opts: any) => {});
|
||||
|
||||
prog.help('build');
|
||||
|
||||
prog.parse(argv);
|
||||
23
types/sade/tsconfig.json
Normal file
23
types/sade/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"sade-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/sade/tslint.json
Normal file
1
types/sade/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user