Labor Law
A multi-purpose utility tool for managing data entries from the command line. Run tasks, manage configurations, track items, search entries, and export data — with full activity logging and history.
Commands
| Command | Description |
|---|
| INLINECODE0 | Execute the main function with given arguments |
| INLINECODE1 |
Show the configuration file path (
$DATA_DIR/config.json) |
|
labor-law status | Display current status (ready/not ready) |
|
labor-law init | Initialize the data directory |
|
labor-law list | List all entries in the data log |
|
labor-law add <entry> | Add a new timestamped entry to the data log |
|
labor-law remove <entry> | Remove a specified entry |
|
labor-law search <term> | Search entries in the data log (case-insensitive) |
|
labor-law export | Export all data from the data log to stdout |
|
labor-law info | Show version number and data directory path |
|
labor-law help | Show the built-in help message |
|
labor-law version | Print the current version |
Data Storage
All data is stored in $DATA_DIR/data.log as plain text with date-prefixed entries. Activity history is logged to $DATA_DIR/history.log with timestamps. The default data directory is ~/.local/share/labor-law/. Override it by setting the LABOR_LAW_DIR environment variable, or it will respect XDG_DATA_HOME if set.
Requirements
- - Bash 4+ with standard Unix utilities (
date, grep, cat) - No external dependencies or API keys required
- Works on any Linux/macOS terminal
When to Use
- 1. Quick data tracking — Use
labor-law add <entry> to log items with automatic timestamps, then labor-law list to review everything you've recorded. - Searching past entries — Run
labor-law search <term> to find specific entries in your data log using case-insensitive matching. - Initializing a new workspace — Use
labor-law init to set up the data directory, then labor-law config to verify the configuration path. - Checking system readiness — Run
labor-law status for a quick confirmation that the tool is ready and operational. - Exporting data for external use — Use
labor-law export to dump all logged data to stdout, which you can redirect to a file or pipe to another tool.
Examples
CODEBLOCK0
How It Works
Labor Law stores all entries locally in ~/.local/share/labor-law/data.log. Each add command prepends the current date to the entry. Every command invocation is logged to history.log with a timestamp for full audit traceability. No data leaves your machine — everything is stored locally in plain text files.
Configuration
Set LABOR_LAW_DIR to change the data directory:
CODEBLOCK1
Default: ~/.local/share/labor-law/
Powered by BytesAgain | bytesagain.com | hello@bytesagain.com
劳动法
一个用于从命令行管理数据条目的多用途工具。运行任务、管理配置、追踪项目、搜索条目和导出数据——并带有完整的活动日志和历史记录。
命令
| 命令 | 描述 |
|---|
| labor-law run <参数> | 使用给定参数执行主功能 |
| labor-law config |
显示配置文件路径($DATA_DIR/config.json) |
| labor-law status | 显示当前状态(就绪/未就绪) |
| labor-law init | 初始化数据目录 |
| labor-law list | 列出数据日志中的所有条目 |
| labor-law add <条目> | 向数据日志添加新的带时间戳条目 |
| labor-law remove <条目> | 移除指定条目 |
| labor-law search <搜索词> | 在数据日志中搜索条目(不区分大小写) |
| labor-law export | 将数据日志中的所有数据导出到标准输出 |
| labor-law info | 显示版本号和数据目录路径 |
| labor-law help | 显示内置帮助信息 |
| labor-law version | 打印当前版本 |
数据存储
所有数据以纯文本形式存储在$DATADIR/data.log中,条目带有日期前缀。活动历史记录以时间戳形式记录到$DATADIR/history.log。默认数据目录为~/.local/share/labor-law/。可通过设置LABORLAWDIR环境变量覆盖,或如果设置了XDGDATAHOME则会遵循该变量。
要求
- - Bash 4+ 及标准Unix工具(date、grep、cat)
- 无需外部依赖或API密钥
- 适用于任何Linux/macOS终端
使用场景
- 1. 快速数据追踪 — 使用labor-law add <条目>记录带自动时间戳的项目,然后使用labor-law list查看所有已记录内容。
- 搜索历史条目 — 运行labor-law search <搜索词>使用不区分大小写的匹配在数据日志中查找特定条目。
- 初始化新工作区 — 使用labor-law init设置数据目录,然后使用labor-law config验证配置路径。
- 检查系统就绪状态 — 运行labor-law status快速确认工具是否就绪且可运行。
- 导出数据供外部使用 — 使用labor-law export将所有记录数据输出到标准输出,可重定向到文件或通过管道传递给其他工具。
示例
bash
初始化数据目录
labor-law init
向数据日志添加条目
labor-law add 审核新员工的雇佣合同
labor-law add 检查加班政策合规性
labor-law add 准备遣散费计算
列出所有条目
labor-law list
搜索特定条目
labor-law search 加班
检查状态
labor-law status
查看配置路径
labor-law config
显示版本和数据目录
labor-law info
导出所有数据
labor-law export > backup.txt
运行任务
labor-law run 季度审查
移除条目
labor-law remove 旧项目
工作原理
劳动法将所有条目本地存储在~/.local/share/labor-law/data.log中。每次add命令都会在当前日期前添加条目。每次命令调用都会记录到history.log中,带有时间戳,以实现完整的审计可追溯性。数据不会离开您的机器——所有内容都本地存储在纯文本文件中。
配置
设置LABORLAWDIR以更改数据目录:
bash
export LABORLAWDIR=/自定义/路径
默认:~/.local/share/labor-law/
由BytesAgain提供 | bytesagain.com | hello@bytesagain.com