mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[yargs-interactive] Update type definition to v2.1 (#37181)
This commit is contained in:
parent
edceaaaa64
commit
247dcd9f19
11
types/yargs-interactive/index.d.ts
vendored
11
types/yargs-interactive/index.d.ts
vendored
@ -1,17 +1,18 @@
|
||||
// Type definitions for yargs-interactive 2.0
|
||||
// Type definitions for yargs-interactive 2.1
|
||||
// Project: https://github.com/nanovazquez/yargs-interactive#readme
|
||||
// Definitions by: Steven Zeck <https://github.com/szeck87>
|
||||
// Nano Vazquez <https://github.com/nanovazquez>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function yargsInteractive(): yargsInteractive.Interactive;
|
||||
|
||||
declare namespace yargsInteractive {
|
||||
interface OptionData {
|
||||
type: string;
|
||||
type: 'input' | 'number' | 'confirm' | 'list' | 'rawlist' | 'expand' | 'checkbox' | 'password' | 'editor';
|
||||
describe: string;
|
||||
default?: string | number | boolean;
|
||||
prompt?: string;
|
||||
options?: string[];
|
||||
default?: string | number | boolean | any[];
|
||||
prompt?: 'always' | 'never' | 'if-no-arg' | 'if-empty';
|
||||
choices?: string[];
|
||||
}
|
||||
interface Option {
|
||||
[key: string]: OptionData | { default: boolean };
|
||||
|
||||
@ -1,19 +1,26 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import yargsInteractive = require("yargs-interactive");
|
||||
import yargsInteractive = require('yargs-interactive');
|
||||
|
||||
const options: yargsInteractive.Option = {
|
||||
color: {
|
||||
describe: "What is your favorite color?",
|
||||
prompt: "always",
|
||||
type: "input",
|
||||
default: "Blue",
|
||||
}
|
||||
name: {
|
||||
describe: 'What is your name?',
|
||||
prompt: 'always',
|
||||
type: 'input',
|
||||
default: 'Nano',
|
||||
},
|
||||
color: {
|
||||
describe: 'What is your favorite color?',
|
||||
prompt: 'always',
|
||||
type: 'list',
|
||||
choices: ['Blue', 'Red', 'Yellow'],
|
||||
default: 'Blue',
|
||||
},
|
||||
};
|
||||
|
||||
yargsInteractive()
|
||||
.usage("$0 <command> [args]")
|
||||
.interactive(options)
|
||||
.then((result: any) => {
|
||||
console.log(result);
|
||||
});
|
||||
.usage('$0 <command> [args]')
|
||||
.interactive(options)
|
||||
.then((result: any) => {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user