Skip to content

Commit c7b8719

Browse files
committed
ahoy fish completion
1 parent c2346ac commit c7b8719

File tree

4 files changed

+67
-1
lines changed

4 files changed

+67
-1
lines changed

.ddev/addon-metadata/pimp-my-shell/manifest.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: pimp-my-shell
22
repository: .
33
version: ""
4-
install_date: "2024-04-01T19:41:31-03:00"
4+
install_date: "2024-04-03T10:04:10-03:00"
55
project_files:
66
- web-build/Dockerfile.pimp-my-shell
77
- homeadditions/.bashrc.d/pimp-my-shell.sh
@@ -10,6 +10,7 @@ project_files:
1010
- commands/web/gum
1111
- commands/host/fish
1212
- homeadditions/.local/share/bash-completion/completions/ahoy
13+
- homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish
1314
- homeadditions/.config/starship.toml
1415
- homeadditions/.config/fish/conf.d/z.fish
1516
- pimp-my-shell/hooks/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#ddev-generated
2+
3+
# @TODO: Try to use ahoy -f as part of the commands so autocomplete works with that
4+
# was playing with `ahoy --help | sed -z 's/.*COMMANDS:\(.*\)GLOBAL.*/\1/' | cut -d ' ' -f 4'`
5+
# to extract commands instead of --generate-bash-completion but needs more work
6+
# apparently argparse can be used to extract the file parameter.
7+
8+
function __fish_ahoy_subcommand
9+
set -l cmd (commandline)
10+
eval $cmd --generate-bash-completion | grep -vw h | grep -vw help
11+
end
12+
13+
function __fish_ahoy_config
14+
set -l cmd (commandline -ct)
15+
echo "cmd: $cmd" >> debug.txt
16+
set -l dirglob ""
17+
set -l dirfind "."
18+
if test -d (string replace -r '(.*)/[^\/]*$' '$1/' $cmd)
19+
set dirglob (string replace -r '(.*)/[^\/]*$' '$1/' $cmd)
20+
set dirfind (string replace -r '(.*)/[^\/]*$' '$1/' $cmd)
21+
end
22+
set -l configs $dirglob.*.yml $dirglob.*.yaml $dirglob.*.yml $dirglob*.yaml
23+
for i in $configs
24+
echo $i
25+
end
26+
find $dirfind -mindepth 1 -maxdepth 1 -type d | sed 's/\.\/\(.*\)/\1/g' | sed 's/$/\//g' | sort
27+
end
28+
29+
complete -c ahoy -f
30+
complete -c ahoy -n "not __fish_seen_subcommand_from (ahoy --generate-bash-completion)" -a "(ahoy --generate-bash-completion)"
31+
complete -c ahoy -n "__fish_seen_subcommand_from (ahoy -h | grep ▼ | cut -d ' ' -f 4)" -a "(__fish_ahoy_subcommand)"
32+
complete -c ahoy -s f -l file -x -a "(__fish_ahoy_config)"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#ddev-generated
2+
3+
# @TODO: Try to use ahoy -f as part of the commands so autocomplete works with that
4+
# was playing with `ahoy --help | sed -z 's/.*COMMANDS:\(.*\)GLOBAL.*/\1/' | cut -d ' ' -f 4'`
5+
# to extract commands instead of --generate-bash-completion but needs more work
6+
# apparently argparse can be used to extract the file parameter.
7+
8+
function __fish_ahoy_subcommand
9+
set -l cmd (commandline)
10+
eval $cmd --generate-bash-completion | grep -vw h | grep -vw help
11+
end
12+
13+
function __fish_ahoy_config
14+
set -l cmd (commandline -ct)
15+
echo "cmd: $cmd" >> debug.txt
16+
set -l dirglob ""
17+
set -l dirfind "."
18+
if test -d (string replace -r '(.*)/[^\/]*$' '$1/' $cmd)
19+
set dirglob (string replace -r '(.*)/[^\/]*$' '$1/' $cmd)
20+
set dirfind (string replace -r '(.*)/[^\/]*$' '$1/' $cmd)
21+
end
22+
set -l configs $dirglob.*.yml $dirglob.*.yaml $dirglob.*.yml $dirglob*.yaml
23+
for i in $configs
24+
echo $i
25+
end
26+
find $dirfind -mindepth 1 -maxdepth 1 -type d | sed 's/\.\/\(.*\)/\1/g' | sed 's/$/\//g' | sort
27+
end
28+
29+
complete -c ahoy -f
30+
complete -c ahoy -n "not __fish_seen_subcommand_from (ahoy --generate-bash-completion)" -a "(ahoy --generate-bash-completion)"
31+
complete -c ahoy -n "__fish_seen_subcommand_from (ahoy -h | grep ▼ | cut -d ' ' -f 4)" -a "(__fish_ahoy_subcommand)"
32+
complete -c ahoy -s f -l file -x -a "(__fish_ahoy_config)"

install.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ project_files:
77
- commands/web/gum
88
- commands/host/fish
99
- homeadditions/.local/share/bash-completion/completions/ahoy
10+
- homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish
1011
- homeadditions/.config/starship.toml
1112
- homeadditions/.config/fish/conf.d/z.fish
1213
- pimp-my-shell/hooks/README.md

0 commit comments

Comments
 (0)