diff options
| author | lukeflo | 2025-05-26 14:55:21 +0200 |
|---|---|---|
| committer | lukeflo | 2025-05-26 14:55:21 +0200 |
| commit | c0dcbcd18a3fba111885fd0eaf8ef18f71cf693a (patch) | |
| tree | 169a78c55c904ef31d84594fe76d85656fd14523 /src | |
| parent | eac547bce389169b867ccdeedc47ba2b8b90511d (diff) | |
| download | bibiman-c0dcbcd18a3fba111885fd0eaf8ef18f71cf693a.tar.gz bibiman-c0dcbcd18a3fba111885fd0eaf8ef18f71cf693a.zip | |
some more doc strings
Diffstat (limited to 'src')
| -rw-r--r-- | src/cliargs.rs | 20 | ||||
| -rw-r--r-- | src/config.rs | 2 | ||||
| -rw-r--r-- | src/main.rs | 2 | ||||
| -rw-r--r-- | src/tui/popup.rs | 17 |
4 files changed, 30 insertions, 11 deletions
diff --git a/src/cliargs.rs b/src/cliargs.rs index a9b12fd..c7a0eb1 100644 --- a/src/cliargs.rs +++ b/src/cliargs.rs @@ -56,7 +56,7 @@ impl CLIArgs { Short('v') | Long("version") => args.versionarg = true, Short('c') | Long("config-file") => args.cfg_path = Some(parser.value()?.parse()?), Long("light-terminal") => args.light_theme = true, - Long("merge-pdf-paths") => { + Long("pdf-dir") => { args.pdf_path = Some(parser.value()?.parse()?); } // Value(pos_arg) => parse_files(&mut args, pos_arg), @@ -126,14 +126,16 @@ POSITIONAL ARGS: Both can be passed multiple times FLAGS: - -h, --help Show this help and exit - -v, --version Show the version and exit - -c, --config-file Path to config file used for current session. - Takes precedence over standard config file. - --light-terminal Enable color mode for light terminal background - --merge-pdf-paths Merge PDF files named by citekey at the given path into - the `file` field of the entry matching the citekey - (might not work with citekeys containing special chars)", + -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=<value> Enable color mode for light terminal background + --pdf-dir=<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"), ); diff --git a/src/config.rs b/src/config.rs index 1532d31..8d50d93 100644 --- a/src/config.rs +++ b/src/config.rs @@ -149,7 +149,7 @@ impl BibiConfig { /// overwright config values with values set explicitly through the /// command line interface - pub fn cli_overwright(&mut self, args: &CLIArgs) { + pub fn cli_overwrite(&mut self, args: &CLIArgs) { if args.pdf_path.is_some() { self.general.pdf_path = args.pdf_path.clone(); } diff --git a/src/main.rs b/src/main.rs index dd82c0f..add1f2e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,7 +59,7 @@ async fn main() -> Result<()> { BibiConfig::default() }; - cfg.cli_overwright(&parsed_args); + cfg.cli_overwrite(&parsed_args); init_error_hooks()?; diff --git a/src/tui/popup.rs b/src/tui/popup.rs index 2a6f18a..a0a61a4 100644 --- a/src/tui/popup.rs +++ b/src/tui/popup.rs @@ -26,11 +26,17 @@ use crate::config::BibiConfig; #[derive(Debug)] pub enum PopupKind { Help, + /// use for a confirmation message MessageConfirm, + /// use for a warning message MessageError, + /// open a resource connected to the entry OpenRes, + /// select file to append entry to AppendToFile, + /// append entry to a bibfile (selected in `AppendToFile` popup) AddEntry, + /// select an item of the current entry to yank to clipboard YankItem, } @@ -108,6 +114,14 @@ impl PopupArea { Text::from(helptext) } + /// Creates a popup message. The needed arguments are: + /// + /// - `message` as `str`: The message displayed in the popup. + /// - `object` as `str`: A possible object added to the message. E.g. the content + /// which gets copied to the clipboard. + /// - `msg_confirm` as `bool`: if `true` its a confirmation message displayed in + /// in the set `confirm_color` (default: green), if `false` its a warning + /// message displayed in the set `warn_color` (default: red). pub fn popup_message(&mut self, message: &str, object: &str, msg_confirm: bool) { if object.is_empty() { self.popup_message = message.to_owned(); @@ -122,6 +136,9 @@ impl PopupArea { self.is_popup = true; } + /// Opens a popup with a selectable list + /// + /// The list items are passed as argument of the kind `Vec<String>`. pub fn popup_selection(&mut self, items: Vec<String>) { self.popup_list = items; // self.popup_kind = Some(PopupKind::SelectRes); |
