Filestar CLI

Filestar CLI (filestarcli) 可通过终端或脚本转换文件,使用与 Filestar 应用相同的 skills。它随 Windows、macOS 和 Linux 版 Filestar 一起提供。

安装

**Windows:**Filestar 安装程序会将 filestarcli 添加到您的 PATH 中。安装后,请打开一个新的终端。您也可以在终端中使用 winget 安装 Filestar。请参阅 Windows。

**macOS:**Filestar 安装程序会将 filestarcli 添加到 /usr/local/bin,适用于 Intel Mac 和 Apple 芯片 Mac。您也可以使用 Homebrew 安装 Filestar。请参阅 macOS。

**Linux:**Filestar AppImage 包含 CLI:请运行 ./Filestar.*.AppImage cli,并在其后添加下方的参数,以替代示例中的 filestarcli。对于没有桌面环境的服务器,也提供仅含 CLI 的下载版本。请参阅 Linux。

**在上述任意系统上仅安装 CLI:**使用 npm(npm install -g filestar,需要 Node.js 18 或更高版本)或作为 .NET 工具安装(dotnet tool install -g Filestar,需要 .NET 10 SDK)。这两种方式都能让您使用 filestarcli 命令,无需安装 Filestar 应用。请参阅 仅安装命令行版本。

有关 winget、Homebrew、npm、.NET 工具和仅含 CLI 的下载版本,请参阅 安装 Filestar 的其他方式。

使用 CLI 需要包含此功能的套餐。

Filestar CLI

示例

将当前文件夹中的 cat.jpg 转换为 cat.png,并保存到 C:\workspace 文件夹(Windows):

filestarcli -i cat.jpg -c "convert to png" -o C:\workspace

在 macOS 或 Linux 上执行相同操作,并保存到您的主文件夹中的 workspace 文件夹:

filestarcli -i cat.jpg -c "convert to png" -o ~/workspace

合并当前文件夹中的 page1.pdf 和 page2.pdf:

filestarcli -i page1.pdf page2.pdf -c "merge"

参数

-i <input>
--input <input>

请指定绝对路径或相对于当前目录的路径。路径可以包含有效的字面路径与通配符(* 和 ?)的组合,但不支持正则表达式。

-o <output>
--output <output>
-o .
-o foo.gif
-o "c:\foo bar\"
-o c:\foo\bar.<Extension>

指定输出的处理方式。如果省略,每个文件将保存到各自的源目录中。

-r
--recursive

递归查找当前目录的子目录中的文件。

-c
--command

命令,例如 "convert to jpg"

-p
--parameters

Skill 参数。

--output-template <output-template>

指定转换后文件的命名方式。如果省略,将使用此模板:<Filename>.<Extension>

--loglevel

可用选项:

  • Normal(默认)
  • Quiet
  • Verbose
--recipe

已保存的 recipe 文件的路径。

--cloud

指定云端 skills 的处理方式。

可用选项:

  • Disallowed(默认)
  • Allowed
  • Forced
--output-conflict

保存文件时出现文件名冲突所使用的策略。

可用选项:

  • AppendNumber(默认)
  • Replace
  • Skip
  • Warn
--version

显示版本信息

 -?, -h, --help

显示帮助和用法信息。

命令

filestarcli register <Activation Code>

使用指定的激活码在当前计算机上注册 Filestar。

filestarcli update

将当前计算机上的 Filestar 更新到最新版本。