From 3f1b7df7f464bc2a25c99867c2c151f8f0961d9a Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Tue, 12 Jul 2022 17:51:44 +0900 Subject: [PATCH] Use a more explicit "terminator" for --regex-cmd --- README.md | 4 ++-- src/main.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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>;