summaryrefslogtreecommitdiffstats
path: root/pkgs/claude-remote.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/claude-remote.nix')
-rw-r--r--pkgs/claude-remote.nix16
1 files changed, 11 insertions, 5 deletions
diff --git a/pkgs/claude-remote.nix b/pkgs/claude-remote.nix
index 48ac7ed..d0da652 100644
--- a/pkgs/claude-remote.nix
+++ b/pkgs/claude-remote.nix
@@ -726,6 +726,10 @@ let
shift
exec journalctl -u "$(unit "$n")" "$@"
;;
+ type) # for the completion
+ name_arg "''${1-}"
+ type_of "$1"
+ ;;
names) # for the completion
names
;;
@@ -751,14 +755,16 @@ let
elif [ "''${COMP_WORDS[1]}" = reset ] || [ "''${COMP_WORDS[1]}" = remove ]; then
COMPREPLY=($(compgen -W "-f --force" -- "$cur"))
elif [ "''${COMP_WORDS[1]}" = start ] || [ "''${COMP_WORDS[1]}" = restart ]; then
- # --type=TYPE (which bash splits into --type, =, TYPE)
- local prev=''${COMP_WORDS[COMP_CWORD-1]}
+ # --type=TYPE (which bash splits into --type, =, TYPE): only the
+ # type it isn't (a new one is a server)
+ local prev=''${COMP_WORDS[COMP_CWORD-1]} other=interactive
+ [ "$(claude-remote type "''${COMP_WORDS[2]}" 2>/dev/null)" != interactive ] || other=server
if [ "$cur" = = ] && [ "$prev" = --type ]; then
- COMPREPLY=(server interactive)
+ COMPREPLY=($other)
elif [ "$prev" = = ] && [ "''${COMP_WORDS[COMP_CWORD-2]}" = --type ]; then
- COMPREPLY=($(compgen -W "server interactive" -- "$cur"))
+ COMPREPLY=($(compgen -W "$other" -- "$cur"))
else
- COMPREPLY=($(compgen -W "--type= --interactive" -- "$cur"))
+ COMPREPLY=($(compgen -W "--type= $([ $other = server ] || echo --interactive)" -- "$cur"))
[ "''${COMPREPLY[*]}" != --type= ] || compopt -o nospace
fi
elif [ "''${COMP_WORDS[1]}" = rename ]; then