Skip to content

Commit

Permalink
docs: 馃摑 updated help page for version system
Browse files Browse the repository at this point in the history
  • Loading branch information
arctic-hen7 committed Jun 29, 2021
1 parent 4a29232 commit dcfd598
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/help_page.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
// This file just defines a single constant for the help page that'll be served to users with `bonnie help`

pub const BONNIE_HELP_PAGE: &str = "
use crate::version::BONNIE_VERSION;

pub fn get_help_page() -> String {
"
Example Usage:
Commands can be specified in bonnie.toml:
version = \"".to_string() + BONNIE_VERSION + "\"
[scripts]
greet.cmd = \"echo \\\"Greetings %lastname. I see your first name is %firstname?\\\"\"
Arguments can be parsed into a command as well:
version = \"" + BONNIE_VERSION + "\"
[scripts]
greet.args = [
\"firstname\",
Expand All @@ -20,11 +25,13 @@ Example Usage:
Arguments can be used multiple times in a command:
version = \"" + BONNIE_VERSION + "\"
[scripts]
greet.cmd = \"echo \"Greetings %lastname. I see your first name is %firstname?\" and not %lastname\"
If a script doesn't need any arguments, you can use shorthand syntax:
version = \"" + BONNIE_VERSION + "\"
[scripts]
foobar = \"echo Hello World\"
Expand All @@ -33,11 +40,13 @@ Example Usage:
Appending arguments:
To append arguments at the end of a script, use shorthand syntax and add a '%%' to the end of the command:
version = \"" + BONNIE_VERSION + "\"
[scripts]
dc = \"docker-compose --env-file .my.env %%\"
Environment variables can also be inserted from custom files, like .env:
version = \"" + BONNIE_VERSION + "\"
env_files = [
\".env\"
]
Expand All @@ -53,4 +62,5 @@ Example Usage:
To run that, use normal arguments syntax:
'bonnie interpolation Donald'.
";
"
}
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod help_page;
mod read_cfg;
mod version;
use crate::command::Command;
use crate::help_page::BONNIE_HELP_PAGE;
use crate::help_page::get_help_page;
use crate::read_cfg::{get_commands_registry_from_cfg, parse_cfg};
pub use crate::version::BONNIE_VERSION;

Expand Down Expand Up @@ -88,5 +88,5 @@ start = \"echo \\\"No start script yet.\\\"\"
}
}
pub fn help() {
println!("{}", BONNIE_HELP_PAGE);
println!("{}", get_help_page());
}

0 comments on commit dcfd598

Please sign in to comment.