diff --git a/.ddev/addon-metadata/pimp-my-shell/manifest.yaml b/.ddev/addon-metadata/pimp-my-shell/manifest.yaml index c419571..227465a 100644 --- a/.ddev/addon-metadata/pimp-my-shell/manifest.yaml +++ b/.ddev/addon-metadata/pimp-my-shell/manifest.yaml @@ -1,7 +1,7 @@ name: pimp-my-shell repository: . version: "" -install_date: "2024-04-01T19:41:31-03:00" +install_date: "2024-04-03T10:04:10-03:00" project_files: - web-build/Dockerfile.pimp-my-shell - homeadditions/.bashrc.d/pimp-my-shell.sh @@ -10,6 +10,7 @@ project_files: - commands/web/gum - commands/host/fish - homeadditions/.local/share/bash-completion/completions/ahoy + - homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish - homeadditions/.config/starship.toml - homeadditions/.config/fish/conf.d/z.fish - pimp-my-shell/hooks/README.md diff --git a/.ddev/homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish b/.ddev/homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish new file mode 100644 index 0000000..36a4c19 --- /dev/null +++ b/.ddev/homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish @@ -0,0 +1,32 @@ +#ddev-generated + +# @TODO: Try to use ahoy -f as part of the commands so autocomplete works with that +# was playing with `ahoy --help | sed -z 's/.*COMMANDS:\(.*\)GLOBAL.*/\1/' | cut -d ' ' -f 4'` +# to extract commands instead of --generate-bash-completion but needs more work +# apparently argparse can be used to extract the file parameter. + +function __fish_ahoy_subcommand + set -l cmd (commandline) + eval $cmd --generate-bash-completion | grep -vw h | grep -vw help +end + +function __fish_ahoy_config + set -l cmd (commandline -ct) + echo "cmd: $cmd" >> debug.txt + set -l dirglob "" + set -l dirfind "." + if test -d (string replace -r '(.*)/[^\/]*$' '$1/' $cmd) + set dirglob (string replace -r '(.*)/[^\/]*$' '$1/' $cmd) + set dirfind (string replace -r '(.*)/[^\/]*$' '$1/' $cmd) + end + set -l configs $dirglob.*.yml $dirglob.*.yaml $dirglob.*.yml $dirglob*.yaml + for i in $configs + echo $i + end + find $dirfind -mindepth 1 -maxdepth 1 -type d | sed 's/\.\/\(.*\)/\1/g' | sed 's/$/\//g' | sort +end + +complete -c ahoy -f +complete -c ahoy -n "not __fish_seen_subcommand_from (ahoy --generate-bash-completion)" -a "(ahoy --generate-bash-completion)" +complete -c ahoy -n "__fish_seen_subcommand_from (ahoy -h | grep ▼ | cut -d ' ' -f 4)" -a "(__fish_ahoy_subcommand)" +complete -c ahoy -s f -l file -x -a "(__fish_ahoy_config)" diff --git a/homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish b/homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish new file mode 100644 index 0000000..36a4c19 --- /dev/null +++ b/homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish @@ -0,0 +1,32 @@ +#ddev-generated + +# @TODO: Try to use ahoy -f as part of the commands so autocomplete works with that +# was playing with `ahoy --help | sed -z 's/.*COMMANDS:\(.*\)GLOBAL.*/\1/' | cut -d ' ' -f 4'` +# to extract commands instead of --generate-bash-completion but needs more work +# apparently argparse can be used to extract the file parameter. + +function __fish_ahoy_subcommand + set -l cmd (commandline) + eval $cmd --generate-bash-completion | grep -vw h | grep -vw help +end + +function __fish_ahoy_config + set -l cmd (commandline -ct) + echo "cmd: $cmd" >> debug.txt + set -l dirglob "" + set -l dirfind "." + if test -d (string replace -r '(.*)/[^\/]*$' '$1/' $cmd) + set dirglob (string replace -r '(.*)/[^\/]*$' '$1/' $cmd) + set dirfind (string replace -r '(.*)/[^\/]*$' '$1/' $cmd) + end + set -l configs $dirglob.*.yml $dirglob.*.yaml $dirglob.*.yml $dirglob*.yaml + for i in $configs + echo $i + end + find $dirfind -mindepth 1 -maxdepth 1 -type d | sed 's/\.\/\(.*\)/\1/g' | sed 's/$/\//g' | sort +end + +complete -c ahoy -f +complete -c ahoy -n "not __fish_seen_subcommand_from (ahoy --generate-bash-completion)" -a "(ahoy --generate-bash-completion)" +complete -c ahoy -n "__fish_seen_subcommand_from (ahoy -h | grep ▼ | cut -d ' ' -f 4)" -a "(__fish_ahoy_subcommand)" +complete -c ahoy -s f -l file -x -a "(__fish_ahoy_config)" diff --git a/install.yaml b/install.yaml index 068263d..ed2bfd9 100644 --- a/install.yaml +++ b/install.yaml @@ -7,6 +7,7 @@ project_files: - commands/web/gum - commands/host/fish - homeadditions/.local/share/bash-completion/completions/ahoy + - homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish - homeadditions/.config/starship.toml - homeadditions/.config/fish/conf.d/z.fish - pimp-my-shell/hooks/README.md