本文整理汇总了TypeScript中argparse.ArgumentParser.addArgumentGroup方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ArgumentParser.addArgumentGroup方法的具体用法?TypeScript ArgumentParser.addArgumentGroup怎么用?TypeScript ArgumentParser.addArgumentGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类argparse.ArgumentParser
的用法示例。
在下文中一共展示了ArgumentParser.addArgumentGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ArgumentParser
var formatterExample = new ArgumentParser({
prog: 'PROG',
formatterClass: RawDescriptionHelpFormatter,
description: 'Keep the formatting\n' +
' exactly as it is written\n' +
'\n' +
'here\n'
});
formatterExample.addArgument(['--foo'], {
help: ' foo help should not\n' +
' retain this odd formatting'
});
formatterExample.addArgument(['spam'], {
'help': 'spam help'
});
var group = formatterExample.addArgumentGroup({
title: 'title',
description: ' This text\n' +
' should be indented\n' +
' exactly like it is here\n'
});
group.addArgument(['--bar'], {
help: 'bar help'
});
formatterExample.printHelp();
示例2: ArgumentParser
const formatterExample = new ArgumentParser({
prog: 'PROG',
formatterClass: RawDescriptionHelpFormatter,
description: `Keep the formatting\nexactly as it is written\n\nhere\n`,
});
formatterExample.addArgument(['--foo'], {
help: `foo help should not\nretain this odd formatting`,
});
formatterExample.addArgument(['spam'], {
help: 'spam help',
});
const group = formatterExample.addArgumentGroup({
title: 'title',
description: `This text\nshould be indented\nexactly like it is here\n`,
});
group.addArgument(['--bar'], {
help: 'bar help'
});
formatterExample.printHelp();
class CustomAction1 extends Action {
constructor(options: ActionConstructorOptions) {
super(options);
}
call(parser: ArgumentParser, namespace: Namespace, values: string | string[], optionString: string | null) {
console.log('custom action 1');
}
}