@acidjs/cli 中文文档教程

发布于 5年前 浏览 18 项目主页 更新于 3年前

Acid JS - CLI ????

CircleCI  npm(作用域)”></a> 
  <a href=License: MIT

Create command line tools using a simple yargs wrapper.

设置很少。

开箱即用。

Install

$ npm install -g @acidjs/cli

Usage

注意:文件夹名为.acid 应该存在于您的项目主目录中。 当您这样做时,您可以配置 cli,并开始创建您的选项和命令。

Create a command:

在名为 .acid/tasks 的目录中创建一个 .js 文件(您可以配置此路径),然后在文件中导出一个包含 4 个条目的数组:

  1. Command (string)
  2. Description (string)
  3. Builder (function)
  4. Handler (function)
module.exports = [
    'hello [name]',
    'An example command',
    (yargs) => {}, 
    (argv) => {
        if(argv.name) console.log(`Hey ${argv.name}!`)
    }
]

在命令行中: alt text

所有文件住在 path.resolve('.acid', config.cli.entry.x) 中的将被注册到 yargs。 例如,这是在每个有效命令 (file) 上实际调用的内容:

yargs.command(
  ...require(
    path.resolve(
      '.acid', 
      config.cli.entry.command, 
      file
    )
  )
)

Configure

要覆盖默认值,请在项目的根目录中创建 .acid/config.yml。 如果您的配置文件中有错误,您将收到通知。

默认值:

cli:
  help: true
  color: magenta
  logErrors: true
  entry:
    commands: tasks
    options: tasks/options

License

MIT 许可证

版权所有 (c) 2020 Michael Arakilian

特此免费向任何获得副本的人授予许可 本软件和相关文档文件(“软件”),处理 在软件中不受限制,包括但不限于权利 使用、复制、修改、合并、发布、分发、再许可和/或出售 该软件的副本,并允许该软件是 提供这样做,但须满足以下条件:

上述版权声明和本许可声明应包含在所有 软件的副本或重要部分。

本软件“按原样”提供,不提供任何形式的明示或保证 暗示的,包括但不限于适销性保证, 适用于特定目的和非侵权。 在任何情况下都不得 作者或版权持有人对任何索赔、损害或其他 责任,无论是在合同、侵权或其他方面的行为中,由以下原因引起, 出于或与软件或使用或其他交易有关 软件。

Acid JS - CLI ????

CircleCI npm (scoped) License: MIT

Create command line tools using a simple yargs wrapper.

Very little setup.

A lot out of the box.

Install

$ npm install -g @acidjs/cli

Usage

Note: A folder named .acid should exist in your projects main direcotry. When you do, you can configure the cli, and start creating your options and commands.

Create a command:

Create a .js file in a directory named .acid/tasks (you can configure this path), then inside the file, export an array with 4 entries:

  1. Command (string)
  2. Description (string)
  3. Builder (function)
  4. Handler (function)
module.exports = [
    'hello [name]',
    'An example command',
    (yargs) => {}, 
    (argv) => {
        if(argv.name) console.log(`Hey ${argv.name}!`)
    }
]

In the command line: alt text

All the files that live within path.resolve('.acid', config.cli.entry.x) will be registered to yargs. For example, this is what actually gets called upon each valid command (file):

yargs.command(
  ...require(
    path.resolve(
      '.acid', 
      config.cli.entry.command, 
      file
    )
  )
)

Configure

To overwrite defaults, create .acid/config.yml in the root directory of your project. If there is a mistake in your config file, you will be notified.

Defaults:

cli:
  help: true
  color: magenta
  logErrors: true
  entry:
    commands: tasks
    options: tasks/options

License

MIT License

Copyright (c) 2020 Michael Arakilian

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文