跳转到内容
项目模板·Pro

Rust 命令行:行数统计

用 Rust 写的命令行工具,按语言统计文件夹里的代码行、注释行和空行。这是一个没有依赖的 Cargo 项目,带单元测试。需要 Linux 环境中的 Rust 和 Cargo(约 370 MB)。

安装它需要 PocketCode Pro。

如果你的 Android 设备上装了 PocketCode,这会在应用里打开此页面。

预览

文件

Cargo.lock
Cargo.toml
README.md
src/count.rs
src/main.rs

README.md

# loc: a Rust command-line tool Counts lines of code, comments and blank lines per language in a folder, like a small `cloc`. It skips `.git`, `target`, `node_modules` and other build or dependency folders. A Cargo project with no dependencies (only the standard library), split into two modules, with unit tests. ## Run it in PocketCode You need the app's Linux environment with Rust and Cargo (install it in Settings › Compilers and runtimes; about 370 MB). 1. Open the terminal in this project's folder (Open Terminal Here, in the editor menu). 2. Build and run it on this project: ```sh cargo run -- . ``` The first build takes a while on a phone; later ones only rebuild what changed. 3. Point it at any folder of your projects, and sort the table: ```sh cargo run -- ../other-project --sort files cargo run -- --help ``` You can also open `src/main.rs` and tap Run: it counts the `src` folder. ## Run the tests ```sh cargo test ``` ## Build a release binary ```sh cargo build --release ./target/release/loc ~/some/folder ``` ## Where things are

此预览已截短。安装后可获得完整内容。

1.0.0 的变更

首个版本。

相关

Python + SQLite 命令行工具Pro项目模板终端里的记账工具:添加和列出支出、按月按类别汇总、导出 CSV。只用标准库(argparse、sqlite3),无需用 pip 安装任何东西,并附带 unittest 测试。需要 Linux 环境中的 Python。无依赖的 Node.js JSON APIPro项目模板基于 node:http 的笔记 API:创建、列出、修改、删除,带输入校验和 JSON 错误信息,数据保存到文件。无需安装任何东西:在 server.js 上点 Run,应用自带的 Node.js 会在 localhost:3000 启动它。附带测试。Next.js + Tailwind + i18nPro项目模板Next.js 15 项目,带 next-intl 和 Tailwind CSS,在 /en 和 /es 提供一个英语和西班牙语页面。深色模式跟随系统。需要带 Node.js 的 Linux 环境;首次 npm install 约下载 400 MB。Rust 代码片段免费代码片段20 个 Rust 代码片段,除一个 serde 结构体外只用标准库:带 From 的错误枚举、迭代器链、用 HashMap 计数、let else、配合 Arc 和 Mutex 的线程、通道以及测试模块。静态落地页Pro项目模板纯 HTML 和 CSS 编写的单页网站:带折叠菜单的页头、首屏、功能网格、常见问题和页脚。颜色跟随系统的浅色或深色模式。无需构建,也不需要 Linux:打开 index.html,点地球图标即可。Flask + SQLite 网页应用Pro项目模板用 Flask 写的阅读清单:服务端渲染页面和普通表单,数据存入 SQLite,另有一个小型 JSON API。测试使用 Flask 的测试客户端。需要 Linux 环境中的 Python 和 pip,会安装 7 个固定版本的包。