aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukeflo2025-07-06 14:41:36 +0200
committerlukeflo2025-07-06 14:41:36 +0200
commitc0970da999e222cadbcc2242fb67686ed5b00ca4 (patch)
treebb4a41d32a3715610b8429047a12ec9a6540ee08
parentb6b74ef40480d86d81bf69467aecb4931750d1de (diff)
downloadbibiman-c0970da999e222cadbcc2242fb67686ed5b00ca4.tar.gz
bibiman-c0970da999e222cadbcc2242fb67686ed5b00ca4.zip
colored help and version
-rw-r--r--src/cliargs.rs100
1 files changed, 57 insertions, 43 deletions
diff --git a/src/cliargs.rs b/src/cliargs.rs
index 46c3012..082ecda 100644
--- a/src/cliargs.rs
+++ b/src/cliargs.rs
@@ -114,52 +114,66 @@ pub fn parse_files(args: Vec<PathBuf>) -> Vec<PathBuf> {
}
pub fn help_func() -> String {
- let help = format!(
- "\
-{} {}
-
-USAGE:
- bibiman [FLAGS] [files/dirs]
-
-POSITIONAL ARGS:
- <file> Path to .bib file
- <dir> Path to directory containing .bib files
-
- Both can be passed multiple times
-
-FLAGS:
- -h, --help Show this help and exit
- -v, --version Show the version and exit
- -c, --config-file=<value> Path to config file used for current session.
- Takes precedence over standard config file.
- --light-terminal Enable color mode for light terminal background
- --pdf-path=<value> Use PDF files named by citekey at the given path and its
- subdirs as value for the `file` field of the entry matching
- the citekey for the current session.
- Does not overwrite or change the original file.
- (might not work with citekeys containing special chars)",
- env!("CARGO_PKG_NAME"),
- env!("CARGO_PKG_VERSION"),
- );
+ let help = vec![
+ format!(
+ "{} {}\n",
+ env!("CARGO_PKG_NAME").fg::<Green>().bold(),
+ env!("CARGO_PKG_VERSION").fg::<LightGreen>(),
+ ),
+ format!(
+ "{}:\n\t{} [Flags] [files/dirs]\n",
+ "USAGE".bold(),
+ "bibiman".bold()
+ ),
+ format!(
+ "{}:\n\t{}\t\tPath to {} file",
+ "POSITIONAL ARGUMENTS".bold(),
+ "<file>".fg::<BrightMagenta>().bold(),
+ ".bib".fg::<BrightBlack>().bold()
+ ),
+ format!(
+ "\t{}\tPath to directory containing {} files",
+ "<directory>".fg::<BrightBlue>().bold(),
+ ".bib".fg::<BrightBlack>().bold()
+ ),
+ format!("\n\t{}", "Both can be passed multiple times".italic()),
+ format!("\n{}:", "FLAGS".bold()),
+ format!("\t{}", "-h, --help".bold().fg::<BrightCyan>()),
+ format!("\t\t{}", "Show this help and exit"),
+ format!("\t{}", "-v, --version".bold().fg::<BrightCyan>()),
+ format!("\t\t{}", "Show the version and exit"),
+ format!("\t{}", "--light-terminal".bold().fg::<BrightCyan>()),
+ format!(
+ "\t\t{}",
+ "Enable default colors for light terminal background"
+ ),
+ format!(
+ "\t{}{}",
+ "-c, --config-file=".bold().fg::<BrightCyan>(),
+ "<value>".bold().italic().fg::<BrightCyan>()
+ ),
+ format!("\t\t{}", "Path to config file used for current session."),
+ format!("\t\t{}", "Takes precedence over standard config file."),
+ format!(
+ "\t{}{}",
+ "--pdf-path=".bold().fg::<BrightCyan>(),
+ "<value>".bold().italic().fg::<BrightCyan>()
+ ),
+ format!("\t\t{}", "Path to directory containing PDF files."),
+ format!(
+ "\t\t{}",
+ "If the pdf files basename matches an entrys citekey,"
+ ),
+ format!(
+ "\t\t{}",
+ "its attached as connected PDF file for the current session."
+ ),
+ format!("\t\t{}", "Does not edit the bibfile itself!"),
+ ];
+ let help = help.join("\n");
help
}
-// pub fn version_func() -> String {
-// let version = format!(
-// "\
-// {} {}
-// {}
-// {}
-
-// Target Triple: {}",
-// env!("CARGO_PKG_NAME"),
-// env!("CARGO_PKG_VERSION"),
-// env!("CARGO_PKG_AUTHORS"),
-// env!("CARGO_PKG_LICENSE"),
-// env!("TARGET")
-// );
-// version
-// }
pub fn version_func() -> String {
let version: Vec<String> = vec![
format!(