Deploy Tool
Deploy Tool v2.0.0 — a utility toolkit for logging, tracking, and managing deployment-related entries from the command line.
Commands
All commands accept optional input arguments. Without arguments, they display recent entries from the corresponding log. With arguments, they record a new timestamped entry.
| Command | Description |
|---|
| INLINECODE0 | Record or view run entries |
| INLINECODE1 |
Record or view check entries |
|
convert <input> | Record or view convert entries |
|
analyze <input> | Record or view analyze entries |
|
generate <input> | Record or view generate entries |
|
preview <input> | Record or view preview entries |
|
batch <input> | Record or view batch entries |
|
compare <input> | Record or view compare entries |
|
export <input> | Record or view export entries |
|
config <input> | Record or view config entries |
|
status <input> | Record or view status entries |
|
report <input> | Record or view report entries |
|
stats | Show summary statistics across all log files |
|
search <term> | Search all log entries for a keyword (case-insensitive) |
|
recent | Display the 20 most recent history log entries |
|
help | Show usage information |
|
version | Print version (v2.0.0) |
Data Storage
All data is stored locally in ~/.local/share/deploy-tool/:
- - Per-command logs — Each command (run, check, convert, etc.) writes to its own
.log file with pipe-delimited timestamp|value format. - history.log — A unified activity log recording every write operation with timestamps.
- Export formats — The
export utility function supports JSON, CSV, and TXT output, written to ~/.local/share/deploy-tool/export.<fmt>.
No external services, databases, or API keys are required. Everything is flat-file and human-readable.
Requirements
- - Bash (v4+ recommended)
- No external dependencies — uses only standard Unix utilities (
date, wc, du, tail, grep, sed, basename, cat)
When to Use
- - When you need to log and track deployment-related activities from the command line
- To maintain a searchable history of deployment operations
- For batch recording of deployment tasks with timestamps
- When you want to export deployment logs in JSON, CSV, or TXT format
- As part of a larger automation pipeline for tracking deployment workflows
- To get quick statistics and summaries of past deployment activities
Examples
CODEBLOCK0
How It Works
Each command follows the same pattern:
- 1. With arguments — Timestamps the input, appends it to the command-specific log file, prints confirmation, and logs to
history.log. - Without arguments — Shows the last 20 entries from that command's log file.
The stats command iterates all .log files, counts entries per file, and reports totals plus disk usage. The search command performs case-insensitive grep across all log files. The recent command tails the last 20 lines of history.log.
Powered by BytesAgain | bytesagain.com | hello@bytesagain.com
部署工具
部署工具 v2.0.0 — 一个用于从命令行记录、跟踪和管理部署相关条目的实用工具包。
命令
所有命令都接受可选的输入参数。不带参数时,它们会显示对应日志中的最近条目。带参数时,它们会记录一个新的带时间戳的条目。
| 命令 | 描述 |
|---|
| run <输入> | 记录或查看运行条目 |
| check <输入> |
记录或查看检查条目 |
| convert <输入> | 记录或查看转换条目 |
| analyze <输入> | 记录或查看分析条目 |
| generate <输入> | 记录或查看生成条目 |
| preview <输入> | 记录或查看预览条目 |
| batch <输入> | 记录或查看批处理条目 |
| compare <输入> | 记录或查看比较条目 |
| export <输入> | 记录或查看导出条目 |
| config <输入> | 记录或查看配置条目 |
| status <输入> | 记录或查看状态条目 |
| report <输入> | 记录或查看报告条目 |
| stats | 显示所有日志文件的汇总统计信息 |
| search <关键词> | 在所有日志条目中搜索关键词(不区分大小写) |
| recent | 显示最近20条历史日志条目 |
| help | 显示使用信息 |
| version | 打印版本号(v2.0.0) |
数据存储
所有数据都本地存储在 ~/.local/share/deploy-tool/ 目录下:
- - 每个命令的日志 — 每个命令(run、check、convert等)都会写入自己的 .log 文件,格式为管道分隔的 时间戳|值。
- history.log — 一个统一的活动日志,记录每次写入操作及其时间戳。
- 导出格式 — export 实用函数支持 JSON、CSV 和 TXT 输出,写入到 ~/.local/share/deploy-tool/export.<格式>。
无需外部服务、数据库或 API 密钥。所有内容都是平面文件且人类可读。
系统要求
- - Bash(推荐 v4+)
- 无外部依赖 — 仅使用标准 Unix 工具(date、wc、du、tail、grep、sed、basename、cat)
使用场景
- - 当您需要从命令行记录和跟踪部署相关活动时
- 维护可搜索的部署操作历史记录
- 批量记录带时间戳的部署任务
- 当您想以 JSON、CSV 或 TXT 格式导出部署日志时
- 作为跟踪部署工作流的更大自动化流水线的一部分
- 获取过去部署活动的快速统计信息和摘要
示例
bash
记录新的运行条目
deploy-tool run 已部署 v1.2.3 到生产环境
查看最近的运行条目(无参数 = 显示历史记录)
deploy-tool run
检查某些内容并记录
deploy-tool check nginx 配置已验证
分析并记录
deploy-tool analyze 内存使用率为 72%
在所有日志中搜索
deploy-tool search 生产环境
查看汇总统计信息
deploy-tool stats
显示所有命令的最近活动
deploy-tool recent
显示工具版本
deploy-tool version
显示完整帮助信息
deploy-tool help
工作原理
每个命令都遵循相同的模式:
- 1. 带参数时 — 为输入添加时间戳,追加到命令特定的日志文件中,打印确认信息,并记录到 history.log。
- 不带参数时 — 显示该命令日志文件中的最后20条条目。
stats 命令遍历所有 .log 文件,统计每个文件的条目数,并报告总数和磁盘使用情况。search 命令在所有日志文件中执行不区分大小写的 grep 搜索。recent 命令显示 history.log 的最后20行。
由 BytesAgain 提供支持 | bytesagain.com | hello@bytesagain.com