本文整理匯總了TypeScript中meow.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: readPkgUp
(async () => {
const { pkg } = await readPkgUp();
if (pkg.name !== '@jokeyrhyme/node-init') {
// package.json is too far up, doesn't belong to this package
throw new Error('unable to find package.json within node-init');
}
updateNotifier({ pkg }).notify();
updateNodejsNotifier();
const cli = meow(
`
Usage:
$ node-init [project]
Options:
--scope [scope] set npm @scope prefix
--check-git-status stop work if un-versioned changes
--no-check-git-status do work even if un-versioned changes
Examples
$ node-init
$ node-init my-project
$ node-init my-project --scope my-org
`,
{
flags: {
checkGitStatus: {
default: true,
type: 'boolean',
},
scope: {
type: 'string',
},
},
},
);
if (!enginesNotify({ pkg })) {
// no engine trouble, proceed :)
const { init } = await import('../lib/index.js');
init(cli.input, cli.flags);
} else {
process.exitCode = 1;
}
})().catch(err => {
示例2: delay
const argv = meow<IFlags>(
`
Usage:
$ npm ${yellow('<task>')} -- ${yellow('<options>')}
Tasks:
run serve start preview server
start alias of "run serve"
test run tests
run coverage generate coverage report
run build build the source code
Options: [${gray('default value')}]
common:
-h, --help show this help message
-d, --development Set NODE_ENV to "development" [${yellow('false')}]
-s, --skip-npm-check
developing:
-p, --port port of preview server [${blue('8888')}]
-l, --livereload the hostname to bind & livereload [${green('"localhost"')}]
--ping emulate the network delay (ms) [${blue('0')}]
-e, --backend destination of backend proxy [${green('"http://localhost:3000"')}]
For more detail of tasks / options, see code in "dev/gulp" directory.
`,
{
flags: {
help : {
alias: 'h',
},
development : {
alias : 'd',
default: DEFAULT_IS_DEVELOPMENT,
type : 'boolean',
},
skipNpmCheck: {
alias : 's',
default: false,
type : 'boolean',
},
port : {
alias : 'p',
default: DEFAULT_PORT,
},
livereload : {
alias : 'l',
default: DEFAULT_LIVERELOAD,
type : 'string',
},
ping : {
default: DEFAULT_PING,
},
backend : {
alias : 'e',
default: DEFAULT_BACKEND,
type : 'string',
},
},
},
)
示例3: checkArgs
export async function checkArgs(): Promise<string> {
const cli = meow(
`
Usage
$ arrivals-osx [install|watch]
Commands
install Installs a plist and triggers launchctl
watch Immediately invokes the arrivals watch function
`,
{
flags: {}
}
);
return cli.input[0];
}
示例4: meow
import sourcesConfig from './sources.json';
/* eslint-disable max-len */
const cli = meow(`
${chalk.dim.underline('Usage:')}
${chalk.dim('$')} ${chalk.green('devcomic')} ${chalk.dim('[')}${chalk.yellow('options')} ${chalk.dim(']')} ${chalk.dim('[')}${chalk.yellow('source')} ${chalk.dim('...]')}
${chalk.dim.underline('Sources:')}
${chalk.yellow('commitstrip')}
${chalk.yellow('xkcd')}
${chalk.yellow('hacktoon')}
${chalk.dim.underline('Options:')}
${chalk.yellow('-p, --preview')}\t${chalk.dim('Opens a preview of the comic image')}
${chalk.dim.underline('Examples:')}
${chalk.dim('$')} ${chalk.green('devcomic')}
${chalk.dim('$')} ${chalk.green('devcomic')} ${chalk.yellow('-p')}
${chalk.dim('$')} ${chalk.green('devcomic')} ${chalk.yellow('commitstrip')}
${chalk.dim('$')} ${chalk.green('devcomic')} ${chalk.yellow('commitstrip xkcd')}
`, {
flags: {
preview: {
type: 'boolean',
alias: 'p'
}
}
});
/* eslint-enable max-len */
const sources = cli.input.length > 0
示例5: main
#!/usr/bin/env node
const meow = require("meow");
import { compare } from "./index";
const cli = meow(`
Usage
$ site-comp <url1> <url2> <output-file-name>
Example
$ site-comp http://google.com http://bing.com diff.png
`, {
alias: {
h: "help"
}
});
async function main(url1: string, url2: string, outputFileName: string) {
await compare(url1, url2, outputFileName);
console.log("Done!");
}
main(cli.input[0], cli.input[1], cli.input[2]);
示例6: meow
#!/usr/bin/env node
import '@babel/polyfill';
import meow from 'meow';
import chalk from 'chalk';
import openImage from '.';
const cli = meow(`
${chalk.dim.underline('Usage:')}
${chalk.dim('$')} ${chalk.green('open-image')} ${chalk.yellow('<image-path>')}
${chalk.yellow('<image-path>')} ${chalk.dim('can be a filesystem path or url to the image')}
${chalk.dim.underline('Examples:')}
${chalk.dim('$')} ${chalk.green('open-image')} ${chalk.yellow('sample-image.jpg')}
${chalk.dim('$')} ${chalk.green('open-image')} ${chalk.yellow('http://site.com/image.jpg')}
`);
const imagePath = cli.input[0];
openImage(imagePath);
示例7: require
const meow = require('meow');
const HTMLparser = require('posthtml-parser');
const TreeRender = require('posthtml-render');
const mkdirp = require('mkdirp');
// @todo optimize tree shaking
const cli = meow({
help: `
Usage
$ inline-css <input>
Options
-i --input <required>
-o? --output?
Examples
$ inline-css -i ./test.html
🌈 unicorns 🌈
`,
alias: {
i: 'input',
o: 'output'
}
});
interface TreeNode {
tag: string,
attrs: any,
content: Array<string | TreeNode>
}