mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
Added types for command-line-usage package
This commit is contained in:
24
types/command-line-usage/command-line-usage-tests.ts
Normal file
24
types/command-line-usage/command-line-usage-tests.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as commandLineUsage from "command-line-usage";
|
||||
|
||||
const sections = [
|
||||
{
|
||||
header: 'A typical app',
|
||||
content: 'Generates something {italic very} important.'
|
||||
},
|
||||
{
|
||||
header: 'Options',
|
||||
optionList: [
|
||||
{
|
||||
name: 'input',
|
||||
typeLabel: '{underline file}',
|
||||
description: 'The input to process.'
|
||||
},
|
||||
{
|
||||
name: 'help',
|
||||
description: 'Print this usage guide.'
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
const usage = commandLineUsage(sections);
|
||||
48
types/command-line-usage/index.d.ts
vendored
Normal file
48
types/command-line-usage/index.d.ts
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// Type definitions for command-line-usage 5.0
|
||||
// Project: https://github.com/75lb/command-line-usage#readme
|
||||
// Definitions by: Andrija Dvorski <https://github.com/Dvorsky>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
declare namespace commandLineUsage {
|
||||
interface Section {
|
||||
list: string[];
|
||||
|
||||
add(content: object): void;
|
||||
emptyLine(): void;
|
||||
header(text: string): void;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
interface SectionData {
|
||||
optionList?: OptionListData[];
|
||||
hide?: string[];
|
||||
group?: string[];
|
||||
header?: string;
|
||||
reverseNameOrder?: boolean;
|
||||
tableOptions?: any;
|
||||
}
|
||||
|
||||
interface OptionListData extends SectionData {
|
||||
name: string;
|
||||
typeLabel?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
interface ContentSectionData extends SectionData {
|
||||
content: string;
|
||||
raw?: boolean;
|
||||
}
|
||||
|
||||
type CommandLineUsageInput =
|
||||
SectionData
|
||||
| SectionData[]
|
||||
| OptionListData
|
||||
| OptionListData[]
|
||||
| ContentSectionData
|
||||
| ContentSectionData[];
|
||||
}
|
||||
|
||||
declare function commandLineUsage(sections: commandLineUsage.CommandLineUsageInput): string | undefined | commandLineUsage.Section;
|
||||
|
||||
export = commandLineUsage;
|
||||
23
types/command-line-usage/tsconfig.json
Normal file
23
types/command-line-usage/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"command-line-usage-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/command-line-usage/tslint.json
Normal file
1
types/command-line-usage/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user