From cbb0dd3fe00ebc455f2bcab334c5804b779e8550 Mon Sep 17 00:00:00 2001 From: sloane <1699281+sloanelybutsurely@users.noreply.github.com> Date: Mon, 18 Mar 2024 16:20:10 -0400 Subject: [PATCH] add support for do ... syntax --- .config/fish/functions/vitally.fish | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.config/fish/functions/vitally.fish b/.config/fish/functions/vitally.fish index e08188a..fbf7698 100644 --- a/.config/fish/functions/vitally.fish +++ b/.config/fish/functions/vitally.fish @@ -1,9 +1,18 @@ function vitally set cmd $argv[1] - set cmds start stop session-name init - if not contains $cmd $cmds + + if not contains $cmd start stop session-name init do echo "usage: vitally ; : start, stop, session-name, init" + return 1 + end + + if test $cmd = "do" + set cmds (string replace -a ',' '' $argv[2..]) else - eval "vitally-$cmd" + set cmds $cmd + end + + for c in $cmds + eval "vitally-$c" end end