#可执行文件 #工作空间 #cargo工作空间 #CLI #运行 #项目 #

应用 runnables-cli

工作空间中运行可执行文件的CLI

12个版本 (7个稳定版)

1.2.4 2024年8月14日
1.1.0 2024年6月3日
1.0.0 2024年5月26日
0.1.4 2024年3月30日
0.1.0 2023年10月22日

#199 in 解析实现

Download history 116/week @ 2024-05-20 44/week @ 2024-05-27 180/week @ 2024-06-03 6/week @ 2024-06-10 16/week @ 2024-07-01 20/week @ 2024-07-29 528/week @ 2024-08-12

每月548次下载

GPL-3.0-or-later

135KB
1K SLoC

Runnables CLI

用于在(通常是cargo)工作空间中运行可执行文件的CLI。

screenshot

安装

cargoinstall runnables-cli

注意。需要Cargo。使用 rustup 安装。

用法

在工作空间目录中只需输入 run

终端用户界面(TUI)将会加载,你可以使用 jk(或上下箭头)来移动选择器。

Enter 选择要运行的选项。或者你可以使用另一个字母来执行特定操作,如 R 表示 cargo run --release。所有可能的字母/操作都在右侧面板中显示。

Tab 激活搜索模式,再次按 Tab 退出搜索并返回过滤后的选择。

在搜索模式下按 Esc 将清除选择并退出搜索,再次按 Esc 将关闭TUI(就像按 q)。

cli to run executables in a workspace

Usage: run [OPTIONS] [PATH]

Arguments:
  [PATH]  [default: .]

Options:
  -s, --search <SEARCH>  
  -c, --color <COLOR>    [default: Blue]
  -i, --ignore <IGNORE>  [possible values: none, run-file, shell, rust-bin, rust-lib, javascript]
  -h, --help             Print help
  -V, --version          Print version

它做什么

  • 递归扫描当前目录和任何嵌套目录。
  • 捕获任何shell脚本、runfile.toml,并读取Cargo.tomls。
  • 向用户展示选项。

Cargo项目

工作空间中所有成员crate都会被选中。它也不一定是工作空间,任何包含Cargo.toml的多个嵌套cargo项目的文件夹也会被选中。

它们将按二进制/库crate分割。

运行文件

runfile.toml 中定义要运行的特定命令。

[just-ls]
description = "logs files / folders in current directory"
cmd = "ls -a"

[ls-in-src]
description = "logs files / folders in src directory"
cmd = "ls -a"
path = "src"

[ls-in-example]
description = "logs files / folders in example directory"
cmd = "ls -a"
path = "runnables-example"

.runignore

由于runnables-cli是递归扫描您的目录,深度嵌套的文件夹或包含许多文件的文件夹可能会使CLI加载时间明显变长。

在这种情况下,我们可以通过添加一个 .runignore 文件来告诉runnables跳过目录。

此文件包含要跳过的目录(相对或绝对)。

依赖关系

~9–22MB
~277K SLoC