本文整理汇总了TypeScript中argv.option函数的典型用法代码示例。如果您正苦于以下问题:TypeScript option函数的具体用法?TypeScript option怎么用?TypeScript option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了option函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor() {
const args = argv
.option({ name: "androidId", short: "a", type: "string" })
.option({ name: "token", short: "t", type: "string" })
.option({ name: "input", short: "i", type: "list,string" })
.option({ name: "output", short: "o", type: "list,string" })
.option({ name: "overwrite", type: "boolean" })
.option({ name: "maxTracksPerPlaylist", short: "m", type: "number" })
.option({ name: "singlePlaylist", type: "boolean" })
.run();
this.androidId = args.options["androidId"];
this.token = args.options["token"];
this.input = args.options["input"];
this.output = args.options["output"];
this.overwrite = args.options["overwrite"] === true;
this.maxTracksPerPlaylist = parseInt(args.options["maxTracksPerPlaylist"]) || 0;
this.singlePlaylist = args.options["singlePlaylist"] === true;
this.validate();
}
开发者ID:nickp10,项目名称:shuffler,代码行数:19,代码来源:args.ts
示例2:
//////////////////////////////////////////////////
import * as argv from 'argv';
argv.option([{
name: 'version',
short: 'v',
type: 'boolean',
description: 'Display version',
example: "misskey-web-logger -v"
}, {
name: 'web',
short: 'w',
type: 'boolean',
description: 'Serve Web',
example: "misskey-web-logger -w"
}, {
name: 'port',
short: 'p',
type: 'int',
description: 'Web port',
example: "misskey-web-logger -w -p 907"
}, {
name: 'debug',
type: 'boolean',
description: 'Enable debug mode',
example: "misskey-web-logger --debug"
}]);
export default argv.run();
开发者ID:syuilo,项目名称:misskey-web-logger,代码行数:30,代码来源:argv.ts
示例3: start
async start() {
const log = (...params: any[]) => {
console.log('[ComponentEngine]', ...params);
};
log('database: connecting ...');
const db = await MongoProvider.connect(this.mongoInfo.url, this.mongoInfo.dbName);
log('components: initializing ...');
const initializedData: { component: IComponent, setupMenu?: ConsoleMenu }[] = [];
for (const component of this.components) {
if (component.init) {
initializedData.push({
component: component,
setupMenu: (await component.init({ db })).setupMenu
});
}
}
// options
argv.option({
name: 'setup',
short: 's',
type: 'boolean',
description: 'Display setup mode'
});
const { options } = argv.run();
// (mode) setup
if (options.setup) {
log('setup mode');
const setupMenus = initializedData
.map(c => { return { setupMenu: c.setupMenu, component: c.component }; })
.filter((c): c is { setupMenu: ConsoleMenu, component: IComponent } => c.setupMenu != null);
await setupComponentMenu(setupMenus);
log('database: disconnecting ...');
await db.disconnect();
return;
}
// (mode) server
log('server mode');
const apiInternal = new ComponentApiInternal(this, db);
log('components: starting ...');
try {
for (const component of this.components) {
await component.handler(new ComponentApi(apiInternal, component));
}
}
catch (err) {
log('component error:');
console.error(err);
log('database: disconnecting ...');
await db.disconnect();
return;
}
// http
log('http: initialize ...');
const app = Express();
app.set('views', apiInternal.http.viewPathes);
app.set('view engine', 'pug');
app.use(passport.initialize());
log('http: registering init handlers ...');
for (const initHandler of apiInternal.http.initHandlers) {
await initHandler(app);
}
log('http: registering route handlers ...');
for (const routeHandler of apiInternal.http.routeHandlers) {
await routeHandler(app);
}
app.listen(this.httpPort, () => {
log('http: started server.');
});
log('ready.');
}
开发者ID:Frost-Dev,项目名称:Frost,代码行数:100,代码来源:ComponentEngine.ts
示例4:
//////////////////////////////////////////////////
// ARGV MANAGER
//////////////////////////////////////////////////
import * as argv from 'argv';
argv.option({
name: 'skip-check-dependencies',
type : 'string',
description: '依存関係のチェックをスキップします',
example: "npm start --skip-check-dependencies"
});
export default argv.run();
开发者ID:syuilo,项目名称:misskey-file,代码行数:14,代码来源:argv.ts
注:本文中的argv.option函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论