我用纱线来获取CLI的论据。我想知道命令和选项之间的区别。
const argv = yargs
.command(
'add',
'Add a new note',
{
title: titleOptions,
body: bodyOptions
})
.argv;和
const argv = yargs
.option('address', {
alias: 'a',
demand: true,
describe: 'Address for fetching weather'
})
.help()
.alias('help', 'h')
.argv发布于 2018-02-03 17:13:55
一个不同之处是语义:命令执行动作,选项改变动作的执行方式。另一个重要的区别是选项可以被赋值。例如:
git commit --message "Initial commit"在上面的示例中,commit是命令,message是选项。message选项的值为“初始提交”。您也可以使用没有值的选项,这些选项被称为“标志”。
git fetch --no-tags在这里,我们使用no-tags标志告诉Git从上游分支获取所有东西,但排除标记。
https://stackoverflow.com/questions/48200876
复制相似问题