@art-suite/cli

中文文档
2.2.3发布于 2026/06/19ISC近 30 天下载 1.1万

Art.Cli

原始使用文档
文档目录4 节
  1. Install
  2. Example
  3. Commands, Args and Options
  4. Values

Art.Cli

Initialized by Art.Build.Configurator

Install

npm install art-cli

Example

Simple example:

# CaffeineScript
&@ArtSuite/Cli.start
  commands:
    sing:       ({song}) -> "♫ #{song} ♫!"
// JavaScript
require("@art-suite/cli").start({
  commands: {
    sing: ({ song }) => `♫ ${song} ♫!`
  })

Outputs:

my-tool sing --song "I'm a lumberjack and I'm okay"
> ♫ I'm a lumberjack and I'm okay ♫!

Parsing

All arguments are parsed using the following rules. This standardizes how the CLI is parsed in a powerful way. It allows you to pass structured data and custom javascript into your code from the CLI.

Commands, Args and Options

myCli myCommand myArg --foo[] foo1 foo2 --bam boom myOtherArg
# command: "myCommand", options: {foo: ["foo1", "foo2"], bam: "boom"}, args: ["myArg", "myOtherArg"]

myCli myCommand myArg --foo=foo1 myOtherArg --bam
# command: "myCommand", options: {foo: "foo1", bam: true}, args: ["myArg", "myOtherArg"]

Values

# parse json from the command-line
myCli myCommand --myObj 'json:{"hi":123}'
# command: "myCommand", options: myObj: {hi: 123}

# parses javascript from the command-line for easy custom-function injection
myCli myCommand --myFunc "js:(v) => v + 1"
# command: "myCommand", options: myFunc: (v) => v + 1

# but wait, I want a string that starts out "js:..." - we've got you:
myCli myCommand --myFunc "string:js:foo"
# command: "myCommand", options: myFunc: "js:foo"

# all these work with args too
myCli myCommand "js:(v) => v + 1"
# command: "myCommand", args: [{myFunc: (v) => v + 1}]

版本与发布记录

@art-suite/cli 共发布 58 个版本,首次发布于 2020/05/08;过去 12 个月发布了 1 个版本。

版本发布日期距今
2.2.3latest2026/06/194 个月前
2.2.22025/11/071 年前
2.2.12024/11/271.9 年前
2.2.02024/08/152 年前
2.1.62024/08/152 年前
2.1.52024/08/152 年前

关于 @art-suite/cli 的常见问题

@art-suite/cli 是什么?

Art.Cli

如何安装 @art-suite/cli?

在项目目录运行 npm install @art-suite/cli,或使用 pnpm add / yarn add / bun add。

@art-suite/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/art-suite__cli 是否存在。

@art-suite/cli 可以商用吗?

@art-suite/cli 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@art-suite/cli 的下载量有多少?

根据 npm 官方下载统计,@art-suite/cli 在 2026/10/07 – 2026/11/05 这 30 天内被下载 10,917 次,日均约 364 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@art-suite/cli 还在维护吗?

最新版本 2.2.3 发布于 2026/06/19(4 个月前);至今共发布 58 个版本,其中过去 12 个月发布了 1 个;首次发布于 2020/05/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。