本文整理汇总了TypeScript中yargs.option函数的典型用法代码示例。如果您正苦于以下问题:TypeScript option函数的具体用法?TypeScript option怎么用?TypeScript option使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了option函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: main
async function main() {
const args: any = yargs
.option("publisher", {
alias: ["p"],
}).argv
const tmpDir = new TmpDir()
const targetDir = process.cwd()
const tempPrefix = path.join(await tmpDir.getTempFile(""), sanitizeFileName(args.publisher))
const cer = `${tempPrefix}.cer`
const pvk = `${tempPrefix}.pvk`
log('When asked to enter a password ("Create Private Key Password"), please select "None".')
const vendorPath = path.join(await getSignVendorPath(), "windows-10", process.arch)
await exec(path.join(vendorPath, "makecert.exe"),
["-r", "-h", "0", "-n", `CN=${args.publisher}`, "-eku", "1.3.6.1.5.5.7.3.3", "-pe", "-sv", pvk, cer])
const pfx = path.join(targetDir, `${sanitizeFileName(args.publisher)}.pfx`)
await unlinkIfExists(pfx)
await exec(path.join(vendorPath, "pvk2pfx.exe"), ["-pvk", pvk, "-spc", cer, "-pfx", pfx])
log(`${pfx} created. Please see https://github.com/electron-userland/electron-builder/wiki/Code-Signing how do use it to sign.`)
const certLocation = "Cert:\\LocalMachine\\TrustedPeople"
log(`${pfx} will be imported into ${certLocation} Operation will be succeed only if runned from root. Otherwise import file manually.`)
await spawn("powershell.exe", ["Import-PfxCertificate", "-FilePath", `"${pfx}"`, "-CertStoreLocation", ""])
tmpDir.cleanup()
}
示例2: listSecretKeysCli
export function listSecretKeysCli(y: yargs.Argv, state: GpgMockState): yargs.Argv {
state.onParsed(action);
return yargs.option('list-secret-keys', {
describe: 'list secret keys',
boolean: true
});
}
示例3: fullGenKeyCli
export function fullGenKeyCli(y: yargs.Argv, state: GpgMockState): yargs.Argv {
state.onParsed(action);
return yargs.option('full-gen-key', {
describe: 'full-gen-key action',
boolean: true
});
}
示例4: function
function Argv$getCompletion() {
var ya = yargs
.option('foobar', {})
.option('foobaz', {})
.completion()
.getCompletion(['./test.js', '--foo'], function (completions) {
console.log(completions)
})
.argv
}
示例5:
function Argv$getCompletion() {
let ya = yargs
.option('foobar', {})
.option('foobaz', {})
.completion()
.getCompletion(['./test.js', '--foo'], (completions) => {
console.log(completions);
})
.argv;
}
示例6: consoleReporter
(() => {
const identityCommandBuilder = _.identity;
return yargs
.option('contracts-dir', {
type: 'string',
default: DEFAULT_CONTRACTS_DIR,
description: 'path of contracts directory to compile',
})
.option('network-id', {
type: 'number',
default: DEFAULT_NETWORK_ID,
description: 'mainnet=1, kovan=42, testrpc=50',
})
.option('should-optimize', {
type: 'boolean',
default: DEFAULT_OPTIMIZER_ENABLED,
description: 'enable optimizer',
})
.option('artifacts-dir', {
type: 'string',
default: DEFAULT_ARTIFACTS_DIR,
description: 'path to write contracts artifacts to',
})
.option('jsonrpc-url', {
type: 'string',
default: DEFAULT_JSONRPC_URL,
description: 'url of JSON RPC',
})
.option('gas-price', {
type: 'string',
default: DEFAULT_GAS_PRICE,
description: 'gasPrice to be used for transactions',
})
.option('account', {
type: 'string',
description: 'account to use for deploying contracts',
})
.option('contracts', {
type: 'string',
default: DEFAULT_CONTRACTS_LIST,
description: 'comma separated list of contracts to compile',
})
.command('compile', 'compile contracts', identityCommandBuilder, consoleReporter(onCompileCommandAsync))
.command(
'deploy',
'deploy a single contract with provided arguments',
deployCommandBuilder,
consoleReporter(onDeployCommandAsync),
)
.help().argv;
})();
示例7: mainNgcc
export function mainNgcc(args: string[]): number {
const options =
yargs
.option('s', {
alias: 'source',
describe: 'A path to the root folder to compile.',
default: './node_modules'
})
.option('f', {
alias: 'formats',
array: true,
describe: 'An array of formats to compile.',
default: ['fesm2015', 'esm2015', 'fesm5', 'esm5']
})
.option('t', {
alias: 'target',
describe: 'A path to a root folder where the compiled files will be written.',
defaultDescription: 'The `source` folder.'
})
.help()
.parse(args);
const sourcePath: string = path.resolve(options['s']);
const formats: EntryPointFormat[] = options['f'];
const targetPath: string = options['t'] || sourcePath;
const transformer = new Transformer(sourcePath, targetPath);
const host = new DependencyHost();
const resolver = new DependencyResolver(host);
const finder = new EntryPointFinder(resolver);
try {
const {entryPoints} = finder.findEntryPoints(sourcePath);
entryPoints.forEach(entryPoint => {
// We transform the d.ts typings files while transforming one of the formats.
// This variable decides with which of the available formats to do this transform.
// It is marginally faster to process via the flat file if available.
const dtsTranformFormat: EntryPointFormat = entryPoint.fesm2015 ? 'fesm2015' : 'esm2015';
formats.forEach(
format => transformer.transform(entryPoint, format, format === dtsTranformFormat));
});
} catch (e) {
console.error(e.stack);
return 1;
}
return 0;
}
示例8: main
async function main() {
const args: any = yargs
.option("arch", {
choices: ["ia32", "x64", "all"],
}).argv
const projectDir = process.cwd()
const devPackageFile = path.join(projectDir, "package.json")
const devMetadata: DevMetadata = await readPackageJson(devPackageFile)
const results: Array<string> = await BluebirdPromise.all([
computeDefaultAppDirectory(projectDir, use(getDirectoriesConfig(devMetadata), it => it!.app)),
getElectronVersion(devMetadata, devPackageFile)
])
// if two package.json â force full install (user wants to install/update app deps in addition to dev)
await installOrRebuild(devMetadata.build, results[0], results[1], args.arch, results[0] !== projectDir)
}
示例9: mainNgcc
export function mainNgcc(args: string[]): number {
const options =
yargs
.option('s', {
alias: 'source',
describe: 'A path to the root folder to compile.',
default: './node_modules'
})
.option('f', {
alias: 'formats',
array: true,
describe: 'An array of formats to compile.',
default: ['fesm2015', 'esm2015', 'fesm5', 'esm5']
})
.option('t', {
alias: 'target',
describe: 'A path to a root folder where the compiled files will be written.',
defaultDescription: 'The `source` folder.'
})
.help()
.parse(args);
const sourcePath: string = path.resolve(options['s']);
const formats: EntryPointFormat[] = options['f'];
const targetPath: string = options['t'] || sourcePath;
const transformer = new Transformer(sourcePath, targetPath);
const host = new DependencyHost();
const resolver = new DependencyResolver(host);
const finder = new EntryPointFinder(resolver);
try {
const {entryPoints} = finder.findEntryPoints(sourcePath);
entryPoints.forEach(
entryPoint => formats.forEach(format => transformer.transform(entryPoint, format)));
} catch (e) {
console.error(e.stack);
return 1;
}
return 0;
}
示例10: main
async function main() {
const args: any = yargs
.option("platform", {
choices: ["linux", "darwin", "win32"],
default: process.platform,
})
.option("arch", {
choices: ["ia32", "x64", "all"],
default: process.arch,
})
.argv
const projectDir = process.cwd()
const config = (await loadConfig(projectDir)) || {}
const results: Array<string> = await BluebirdPromise.all([
computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)),
getElectronVersion(config, projectDir)
])
// if two package.json â force full install (user wants to install/update app deps in addition to dev)
await installOrRebuild(config, results[0], results[1], args.platform, args.arch, results[0] !== projectDir)
}