summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-23 00:46:14 +0000
committertv <tv@krebsco.de>2026-11-23 00:46:14 +0000
commit4ce2d779fbb72fa6fcc394c897778f6c3f848750 (patch)
tree96e38209d0e0fabf94d25cfa9c0be8fb5d2ce118
parent79e3cbcf061eccf75ed82c80da7715bdfea679d4 (diff)
pkgs/claude-remote: complete --type with the type a remote isn't
claude-remote type NAME (for the completion) says its type, so that completion offers --type= only with the other one, and --interactive only for a server (or a new one, which would be a server).
-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