Tag: Cli

使用Swift Package Manager ArgumentParser处理命令

在命令行应用程序中解析参数不是一件容易的事。 随着时间的推移,应用程序可以演变为支持许多功能,这使得支持的参数数量大大增加。 例如,令人印象深刻的curl命令行工具具有207个不同的参数选项,包括参数和标志。 大量的选择使curl非常灵活和有力。 但是,它也很难使用。 很难学习和掌握。 较新的命令行工具(例如git , gem , carthage或travis通过将其分组在子命令中来更好地组织其功能。 例子: git clone , git fetch , git branch , git commit , git push … gem install , gem update , gem build … carthage update , carthage build , carthage archive … travis login , travis monitor , travis status … 让我们看看如何使用Swift […]