From: Stephen Seo Date: Tue, 12 Jul 2022 08:51:44 +0000 (+0900) Subject: Use a more explicit "terminator" for --regex-cmd X-Git-Tag: 0.1.0~12 X-Git-Url: https://git.seodisparate.com/stephenseo/search/main.js?a=commitdiff_plain;h=3f1b7df7f464bc2a25c99867c2c151f8f0961d9a;p=swaybar_info Use a more explicit "terminator" for --regex-cmd --- diff --git a/README.md b/README.md index 6c86ca1..a7e5256 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,8 @@ Put the following in your `~/.config/sway/config`: # cause the program to omit network traffic stats. status_command $HOME/.config/sway/swaybar_info --netdev=enp7s0 - # One can use the "--regex-cmd=,," option like so: - status_command $HOME/.config/sway/swaybar_info --regex-cmd="acpi,-b,[0-9]+%.*" + # One can use the "--regex-cmd=[SPLIT][SPLIT]" option like so: + status_command $HOME/.config/sway/swaybar_info --regex-cmd="acpi[SPLIT]-b[SPLIT][0-9]+%.*" # This example gets battery info into the bar. # Note that the portion is optional. } diff --git a/src/main.rs b/src/main.rs index 6650e09..ab008f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,7 +16,7 @@ fn main() { let mut cmds: Vec<(&str, Vec<&str>, regex::Regex)> = Vec::new(); for regex_cmd in &args_result.regex_cmds { - let mut split_strs = regex_cmd.split_terminator(','); + let mut split_strs = regex_cmd.split_terminator("[SPLIT]"); let cmd: &str = split_strs.next().expect("Should have cmd in option"); let mut args: Vec<&str> = Vec::new(); let mut next: Option<&str>;