diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-01-29 21:14:41 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:53 +0100 |
commit | a91e003fcdb63e80172b2c001597f4042179d04e (patch) | |
tree | 945df64f20313967d2e41c626007ea14c69eca9b /slack/commands.py | |
parent | df8e65da3f323c0c7fcb16a8a05fa6355a2b40a7 (diff) | |
download | wee-slack-a91e003fcdb63e80172b2c001597f4042179d04e.tar.gz |
Only connect to all teams in /slack connect when -all is given
Diffstat (limited to 'slack/commands.py')
-rw-r--r-- | slack/commands.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/slack/commands.py b/slack/commands.py index 8dfce84..bcdeb69 100644 --- a/slack/commands.py +++ b/slack/commands.py @@ -32,7 +32,7 @@ commands: Dict[str, Command] = {} def parse_options(args: str): - regex = re.compile(" +-([^ =]+)(?:=([^ ]+))?") + regex = re.compile("(?:^| )+-([^ =]+)(?:=([^ ]+))?") pos_args = regex.sub("", args) options: Dict[str, Optional[str]] = { match.group(1): match.group(2) for match in regex.finditer(args) @@ -112,7 +112,7 @@ def command_slack(buffer: str, args: List[str], options: Dict[str, Optional[str] print("ran slack") -@weechat_command("%(slack_workspaces)") +@weechat_command("%(slack_workspaces)|-all") def command_slack_connect( buffer: str, args: List[str], options: Dict[str, Optional[str]] ): @@ -123,7 +123,7 @@ def command_slack_connect( await workspace.connect() else: print_error(f'workspace "{args[0]}" not found') - else: + elif options.get("all", False) is None: for workspace in shared.workspaces.values(): await workspace.connect() |