3 releases
0.1.2 | Jul 29, 2024 |
---|---|
0.1.1 | Jul 27, 2024 |
0.1.0 | Jul 27, 2024 |
#1380 in Development tools
10KB
100 lines
a simple Block Header Generator
Download
cargo install bhg
Setup
- Create the
bhg
directory in the.config
directory:mkdir -p ~/.config/bhg
- Inside the directory create a
variables.json
, which contains constants that can be used as variables in the block-headerbase.<file extension>
- for each file typebhg output.c
will use the~/.config/bhg/base.c
as a base filebhg output.rs
will use the~/.config/bhg/base.rs
as a base file
Usage
Command
bhg <output file> <description>
Special Variables
Variable | Value source |
---|---|
description | passed as command line argument |
year | the current year |
month | the current month |
day | the current day |
hour | the current hour |
minute | the current minute |
second | the current second |
microsecond | the current microsecond |
weekday | the current weekday (monday = 1, ..., sunday = 7) |
weekdayName | the current weekday name |
monthName | the current month name |
timestamp | the current timestamp |
timestampMS | the current timestamp in milliseconds |
timestampISO | the current timestamp in ISO format |
Example
bhg output.c This is a description
variables file
{
"name": "John Doe",
"email": "john.doe@gmail.com"
}
base.c file - lines prefixed with ->
will be centered
/*
-------------------------------------------------------------
->ABC Company
-------------------------------------------------------------
->{name}, {day}-{month}-{year}
-------------------------------------------------------------
->{email}, {description}
-------------------------------------------------------------
This line won't be centered {weekdayName}
-------------------------------------------------------------
*/
output.c file - generated in the current working directory
/*
-------------------------------------------------------------
ABC Company
-------------------------------------------------------------
John Doe, 31-12-2023
-------------------------------------------------------------
john.doe@gmail.com, This is a description
-------------------------------------------------------------
This line won't be centered Sunday
-------------------------------------------------------------
*/
Dependencies
~1–12MB
~82K SLoC