feat: implement __rand_string generator and update jobrunner to use tmux
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# Copyright (C) 2026 Rootiest
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
complete -c __rand_string -f
|
||||
|
||||
complete -c __rand_string -s s -l separator -x -a 'dash underscore dot none' -d 'Set separator for following words'
|
||||
complete -c __rand_string -s c -l case -x -a 'lower upper title' -d 'Set casing for following words'
|
||||
|
||||
# List of all available lists in data/words
|
||||
set -l categories
|
||||
if set -q __fish_config_dir
|
||||
set categories (string replace -r '\.txt$' '' (command ls $__fish_config_dir/data/words/*.txt 2>/dev/null | command xargs -n 1 basename 2>/dev/null))
|
||||
end
|
||||
|
||||
for cat in $categories
|
||||
complete -c __rand_string -a "$cat" -d "Pick a random word from the $cat list"
|
||||
end
|
||||
|
||||
complete -c __rand_string -a 'digits=' -d 'Generate N random digits (e.g. digits=3)'
|
||||
complete -c __rand_string -a 'literal=' -d 'Insert a literal string exactly as provided'
|
||||
@@ -6,7 +6,25 @@
|
||||
|
||||
# Offer running jobs as name<TAB>description pairs.
|
||||
function __jobrunner_complete_jobs
|
||||
for row in (__jobrunner_sessions)
|
||||
set -l tool ""
|
||||
set -l tokens (commandline -opc)
|
||||
set -l idx 1
|
||||
while test $idx -le (count $tokens)
|
||||
switch $tokens[$idx]
|
||||
case -t --tool
|
||||
set idx (math $idx + 1)
|
||||
if test $idx -le (count $tokens)
|
||||
set tool $tokens[$idx]
|
||||
end
|
||||
case '--tool=*'
|
||||
set tool (string replace -- "--tool=" "" $tokens[$idx])
|
||||
case '-t*'
|
||||
set tool (string replace -r "^-t" "" $tokens[$idx])
|
||||
end
|
||||
set idx (math $idx + 1)
|
||||
end
|
||||
|
||||
for row in (__jobrunner_sessions $tool)
|
||||
set -l f (string split \t -- $row)
|
||||
printf '%s\t%s job (PID %s)\n' $f[1] $f[3] $f[2]
|
||||
end
|
||||
@@ -18,6 +36,10 @@ set -l needs_job "__fish_seen_subcommand_from attach kill logs -a --attach -k --
|
||||
# No file completions; jobs are named, not paths.
|
||||
complete -c jobrunner -f
|
||||
|
||||
# Backend tool selection flag.
|
||||
complete -c jobrunner -n "not __fish_seen_subcommand_from $subcmds" \
|
||||
-s t -l tool -x -a "tmux screen" -d 'Force specific backend'
|
||||
|
||||
# Subcommands (only as the first argument).
|
||||
complete -c jobrunner -n "not __fish_seen_subcommand_from $subcmds" \
|
||||
-a run -d 'Start a named job in the background'
|
||||
|
||||
Reference in New Issue
Block a user