diff options
| author | Deposite Pirate | 2026-02-15 04:49:58 +0100 |
|---|---|---|
| committer | Deposite Pirate | 2026-02-15 04:49:58 +0100 |
| commit | d5a8141fc1dead8e053ada36e66157b5e382cfb5 (patch) | |
| tree | bf79515c7dcb0a90417ffa798bd32bdc93f0b164 /functions | |
| parent | 18125a817d8033216d8ffb12ba2aad87e85110c6 (diff) | |
Enhance lscmd with textql
modified: functions/lscmd.fish
new file: progs.csv
Diffstat (limited to 'functions')
| -rw-r--r-- | functions/lscmd.fish | 89 |
1 files changed, 50 insertions, 39 deletions
diff --git a/functions/lscmd.fish b/functions/lscmd.fish index 004dfc8..d428c3e 100644 --- a/functions/lscmd.fish +++ b/functions/lscmd.fish @@ -1,57 +1,68 @@ -function lscmd --description "View installed useful command line programs" +function lscmd --description "Show installed useful command line tools" + +set progsfile "$__fish_config_dir/progs.csv" + +if not command -sq 'textql' + echo "Can't find textql." + return 1 +end if not functions -q is-installed echo "No is-installed function defined." return 1 end -set -f compress 'libarchive' 'bzip3' 'p7zip' 'unrar' 'unshield' 'cabextract' -set -f crypt 'age' 'b3sum' -set -f shell 'exa' 'tmux' 'walk' 'moar' 'most' 'fcp' -set -f editor 'neovim' 'micro' 'nano' -set -f file 'mc' 'nnn' 'fdupes' -set -f bin 'hexyl' -set -f text 'bat' 'ripgrep' 'sd' 'ugrep' 'grex' 'since' 'difftastic' 'vbindiff' -set -f sys 'htop' 'btop' 'duf' 'ncdu' 'procs' -set -f sec 'hashcat' -set -f img 'viu' 'timg' -set -f markdown 'glow' 'mdcat' -set -f db 'csview' 'textql' -set -f dev 'strace' 'lurk' -set -f www 'links' -set -f mail 'aerc' -set -f gopher 'ncgopher' -set -f gemini 'clagrange' 'amfora' 'ncgopher' -set -f chat 'weechat' 'toxic' -set -f ftp 'lftp' -set -f http 'curlie' 'xh' 'hurl' -set -f mirror 'wget' 'gemget' 'httrack' 'crawley' -set -f dns 'doggo' 'dog' -set -f netmon 'bandwhich' 'iftop' 'netscanner' 'trippy' 'nload' 'dnstop' -set -f netsec 'nmap' 'ngrep' 'rustscan' 'ssldump' -set -f sync 'rsync' -set -f man 'tldr' -set -f sound 'sox' 'mp3gain' -set -f graphics 'graphicsmagick' -set -f xorg 'xdotool' 'yank' +function _get_basedbname -a progdb + set -f baseprogdbname (path basename $progdb) + echo (path change-extension '' $baseprogdbname) +end + +function _get_categories -a progdb + set bnprogdb (_get_basedbname $progdb) + command textql -header -sql "SELECT DISTINCT category FROM $bnprogdb" $progdb +end + +function _get_progs_by_category -a progdb -a category + set bnprogdb (_get_basedbname $progdb) + command textql -header -sql "SELECT name FROM $bnprogdb WHERE category = '$category'" $progdb +end + +function _get_desc_by_progname -a progdb -a progname + set bnprogdb (_get_basedbname $progdb) + command textql -header -sql "SELECT description FROM $bnprogdb WHERE name = '$progname'" $progdb +end -set -f -a mul $img $sound $graphics -set -f -a net $www $mail $gopher $gemini $chat $ftp $http $mirror $dns $netmon $netsec -set -f -a all $net $mul $compress $crypt $shell $editor $file $bin $text $sys $sec $markdown $db $dev $sync $man $xorg +function _pp_category -a category + printf "%s" (string upper (string sub -s 1 -l 1 $category[1]))(string sub -s 2 $category[1]) +end -for element in (string join0 $all | sort -z | uniq -z | string split0) - if is-installed $element +function _pp_prog_status -a prog + if is-installed $prog set_color green - printf $element + printf "%s " $prog set_color normal else set_color red - printf $element + printf "%s " $prog set_color normal end - printf ' ' end -printf '\n' +echo +set_color blue +echo "List of command line tools" +set_color normal +echo + +for category in (_get_categories $progsfile) + set_color yellow + printf "\n%s\n\n" (_pp_category $category) + set_color normal + + for prog in (_get_progs_by_category $progsfile $category) + printf "%s " (_pp_prog_status $prog) + _get_desc_by_progname $progsfile $prog + end +end end |
