bhg

Crates.iobhg
lib.rsbhg
version0.1.2
sourcesrc
created_at2024-07-27 11:49:54.546595
updated_at2024-07-29 18:46:35.719359
descriptionA simple Block Header Generator
homepage
repositoryhttps://github.com/antoniosubasic/bhg
max_upload_size
id1317218
size24,455
Antonio Subašić (antoniosubasic)

documentation

https://github.com/antoniosubasic/bhg#readme

README

Version Downloads

a simple Block Header Generator

Download

cargo install bhg

Setup

  1. Create the bhg directory in the .config directory: mkdir -p ~/.config/bhg
  2. Inside the directory create a
    • variables.json, which contains constants that can be used as variables in the block-header
    • base.<file extension> - for each file type
      • bhg output.c will use the ~/.config/bhg/base.c as a base file
      • bhg 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
-------------------------------------------------------------
*/
Commit count: 0

cargo fmt