@types/command-line-usage
Advanced tools
Comparing version 5.0.0 to 5.0.1
// 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 by: matrumz <https://github.com/matrumz> | ||
// Andrija Dvorski <https://github.com/Dvorsky> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.2 | ||
/** | ||
* Generates a usage guide suitable for a command-line app. | ||
* @param sections One or more Section objects | ||
* @alias module:command-line-usage | ||
*/ | ||
declare function commandLineUsage(sections: commandLineUsage.Section | commandLineUsage.Section[]): string; | ||
export = commandLineUsage; | ||
declare namespace commandLineUsage { | ||
interface Section { | ||
list: string[]; | ||
/** Section object. */ | ||
type Section = Content | OptionList; | ||
add(content: object): void; | ||
emptyLine(): void; | ||
header(text: string): void; | ||
toString(): string; | ||
} | ||
interface SectionData { | ||
optionList?: OptionListData[]; | ||
hide?: string[]; | ||
group?: string[]; | ||
/** A Content section comprises a header and one or more lines of content. */ | ||
interface Content { | ||
/** The section header, always bold and underlined. */ | ||
header?: string; | ||
reverseNameOrder?: boolean; | ||
tableOptions?: any; | ||
/** | ||
* Overloaded property, accepting data in one of four formats. | ||
* 1. A single string (one line of text). | ||
* 2. An array of strings (multiple lines of text). | ||
* 3. An array of objects (recordset-style data). In this case, the data will be rendered in table format. The property names of each object are not important, so long as they are | ||
* consistent throughout the array. | ||
* 4. An object with two properties - data and options. In this case, the data and options will be passed directly to the underlying table layout module for rendering. | ||
*/ | ||
content?: string | string[] | any[] | { data: any; options: any }; | ||
/** Set to true to avoid indentation and wrapping. Useful for banners. */ | ||
raw?: boolean; | ||
} | ||
interface OptionListData extends SectionData { | ||
/** Describes a command-line option. Additionally, if generating a usage guide with command-line-usage you could optionally add description and typeLabel properties to each definition. */ | ||
interface OptionDefinition { | ||
name: string; | ||
/** | ||
* The type value is a setter function (you receive the output from this), enabling you to be specific about the type and value received. | ||
* | ||
* The most common values used are String (the default), Number and Boolean but you can use a custom function. | ||
*/ | ||
type?: any; | ||
/** getopt-style short option names. Can be any single character (unicode included) except a digit or hyphen. */ | ||
alias?: string; | ||
/** Set this flag if the option takes a list of values. You will receive an array of values, each passed through the type function (if specified). */ | ||
multiple?: boolean; | ||
/** Identical to multiple but with greedy parsing disabled. */ | ||
lazyMultiple?: boolean; | ||
/** Any values unaccounted for by an option definition will be set on the defaultOption. This flag is typically set on the most commonly-used option to make for more concise usage. */ | ||
defaultOption?: boolean; | ||
/** An initial value for the option. */ | ||
defaultValue?: any; | ||
/** | ||
* When your app has a large amount of options it makes sense to organise them in groups. | ||
* | ||
* There are two automatic groups: _all (contains all options) and _none (contains options without a group specified in their definition). | ||
*/ | ||
group?: string | string[]; | ||
/** A string describing the option. */ | ||
description?: string; | ||
/** A string to replace the default type string (e.g. <string>). It's often more useful to set a more descriptive type label, like <ms>, <files>, <command>, etc.. */ | ||
typeLabel?: string; | ||
description?: string; | ||
} | ||
interface ContentSectionData extends SectionData { | ||
content: string; | ||
raw?: boolean; | ||
/** A OptionList section adds a table displaying details of the available options. */ | ||
interface OptionList { | ||
header?: string; | ||
/** An array of option definition objects. */ | ||
optionList?: OptionDefinition[]; | ||
/** If specified, only options from this particular group will be printed. */ | ||
group?: string | string[]; | ||
/** The names of one of more option definitions to hide from the option list. */ | ||
hide?: string | string[]; | ||
/** If true, the option alias will be displayed after the name, i.e. --verbose, -v instead of -v, --verbose). */ | ||
reverseNameOrder?: boolean; | ||
/** An options object suitable for passing into table-layout. */ | ||
tableOptions?: any; | ||
} | ||
type CommandLineUsageInput = | ||
SectionData | ||
| SectionData[] | ||
| OptionListData | ||
| OptionListData[] | ||
| ContentSectionData | ||
| ContentSectionData[]; | ||
} | ||
declare function commandLineUsage(sections: commandLineUsage.CommandLineUsageInput): string | undefined | commandLineUsage.Section; | ||
export = commandLineUsage; |
{ | ||
"name": "@types/command-line-usage", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "TypeScript definitions for command-line-usage", | ||
@@ -8,2 +8,7 @@ "license": "MIT", | ||
{ | ||
"name": "matrumz", | ||
"url": "https://github.com/matrumz", | ||
"githubUsername": "matrumz" | ||
}, | ||
{ | ||
"name": "Andrija Dvorski", | ||
@@ -21,4 +26,4 @@ "url": "https://github.com/Dvorsky", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "c8374d5385ab4508621f4547e5f1698da49db0c16026b1643287c1105752a957", | ||
"typesPublisherContentHash": "1e97df7a1f2ed5154a71f62793335ec053ddb18b5bb243bc831f4777e5df024e", | ||
"typeScriptVersion": "2.2" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Thu, 29 Mar 2018 13:00:21 GMT | ||
* Last updated: Tue, 24 Apr 2018 23:52:29 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Andrija Dvorski <https://github.com/Dvorsky>. | ||
These definitions were written by matrumz <https://github.com/matrumz>, Andrija Dvorski <https://github.com/Dvorsky>. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7004
77