]> git.seodisparate.com - swaybar_info/commitdiff
Use a more explicit "terminator" for --regex-cmd
authorStephen Seo <seo.disparate@gmail.com>
Tue, 12 Jul 2022 08:51:44 +0000 (17:51 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Tue, 12 Jul 2022 08:51:44 +0000 (17:51 +0900)
README.md
src/main.rs

index 6c86ca1885e38ea2f56091df784d653903b40a03..a7e5256ed7788d14438ed86954eb6fbf640911f2 100644 (file)
--- 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=<cmd>,<args...>,<regex>" option like so:
-        status_command $HOME/.config/sway/swaybar_info --regex-cmd="acpi,-b,[0-9]+%.*"
+        # One can use the "--regex-cmd=<cmd>[SPLIT]<args...>[SPLIT]<regex>" 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 <args...> portion is optional.
     }
index 6650e09a7e954652fbfd66998bd257a813bb12fc..ab008f6029088467a31eb2138f01da2f6683d330 100644 (file)
@@ -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>;