Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameterized documentation. #673

Merged
merged 5 commits into from
Sep 29, 2019
Merged

Parameterized documentation. #673

merged 5 commits into from
Sep 29, 2019

Conversation

eth-p
Copy link
Collaborator

@eth-p eth-p commented Sep 27, 2019

Fixes #659.

Although it's slightly overkill, this uses Liquid for templating.
It's a well-tested templating engine, and it shouldn't break anytime soon.

Changes

  • The manual page has been moved from doc/bat.1 to assets/manual/bat.1.in
  • The fish completion file has been moved from assets/completions/bat.fish to assets/completions/bat.fish.in
  • The generated files have been added to the .gitignore.
    Keeping them in the repo is redundant, and it will discourage people from copying them directly from GitHub.

Information

Certain information is now parameterized using environment variables:

  • PROJECT_NAME -- Set this to change the project name (default: bat).
  • PROJECT_EXECUTABLE -- Set this to change the executable name (in documentation only; default: value of PROJECT_NAME).

Caveats

The executable name can't be changed from an environment variable.
For this reason, I'm also keeping the generated files as bat.*.

If any of the files need to be renamed when packaging, it should be done in an external packaging script.


// Read environment variables.
lazy_static! {
pub static ref PROJECT_NAME: &'static str = option_env!("PROJECT_NAME").unwrap_or("bat");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! I didn't know option_env!(…).

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much! This looks great.

@eth-p eth-p merged commit 047a6f3 into sharkdp:master Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parameterize bat name, documentation.
2 participants