3个版本
0.1.2 | 2024年7月29日 |
---|---|
0.1.1 | 2024年7月27日 |
0.1.0 | 2024年7月27日 |
#426 在 开发工具
413 每月下载量
10KB
100 代码行
简单的 区块头生成器
下载
cargo install bhg
设置
- 在
.config
目录中创建bhg
目录:mkdir -p ~/.config/bhg
- 在目录内创建一个
variables.json
,其中包含可以用于区块头的常量base.<文件扩展名>
- 对于每种文件类型bhg output.c
将使用~/.config/bhg/base.c
作为基础文件bhg output.rs
将使用~/.config/bhg/base.rs
作为基础文件
用法
命令
bhg <output file> <description>
特殊变量
变量 | 值来源 |
---|---|
描述 | 作为命令行参数传递 |
year | 当前年份 |
month | 当前月份 |
day | 当前日期 |
hour | 当前小时 |
minute | 当前分钟 |
second | 当前秒 |
microsecond | 当前微秒 |
weekday | 当前星期(星期一=1,...,星期日=7) |
weekdayName | 当前星期名称 |
monthName | 当前月份名称 |
timestamp | 当前时间戳 |
timestampMS | 当前时间戳(毫秒) |
timestampISO | 当前时间戳(ISO格式) |
示例
bhg output.c This is a description
变量文件
{
"name": "John Doe",
"email": "[email protected]"
}
基础.c文件 - 以->
为前缀的行将居中
/*
-------------------------------------------------------------
->ABC Company
-------------------------------------------------------------
->{name}, {day}-{month}-{year}
-------------------------------------------------------------
->{email}, {description}
-------------------------------------------------------------
This line won't be centered {weekdayName}
-------------------------------------------------------------
*/
输出.c文件 - 在当前工作目录中生成
/*
-------------------------------------------------------------
ABC Company
-------------------------------------------------------------
John Doe, 31-12-2023
-------------------------------------------------------------
[email protected], This is a description
-------------------------------------------------------------
This line won't be centered Sunday
-------------------------------------------------------------
*/
依赖项
~1–12MB
~82K SLoC