···2323 names=$(ls "${session_dir}"/*.json 2>/dev/null | xargs -I{} basename {} .json)
2424 COMPREPLY=($(compgen -W "${names}" -- "${cur}"))
2525 fi
2626+ # Flags per subcommand
2727+ if [[ "${cur}" == -* ]]; then
2828+ case "${COMP_WORDS[1]}" in
2929+ attach|a) COMPREPLY=($(compgen -W "--auto-restart -r" -- "${cur}")) ;;
3030+ peek) COMPREPLY=($(compgen -W "--follow -f --plain" -- "${cur}")) ;;
3131+ send) COMPREPLY=($(compgen -W "--seq --with-delay" -- "${cur}")) ;;
3232+ restart) COMPREPLY=($(compgen -W "--yes -y" -- "${cur}")) ;;
3333+ esac
3434+ fi
3535+ ;;
3636+ list|ls)
3737+ if [[ "${cur}" == -* ]]; then
3838+ COMPREPLY=($(compgen -W "--json" -- "${cur}"))
3939+ fi
2640 ;;
2741 run)
2842 # After --, fall back to default file completion
+69
completions/pty.fish
···11+# Fish completion for pty
22+# Persistent terminal sessions with detach/attach support
33+# Place in ~/.config/fish/completions/ or install via: npm run install-completions
44+55+function __pty_sessions
66+ set -l session_dir "$PTY_SESSION_DIR"
77+ if test -z "$session_dir"
88+ set session_dir "$HOME/.local/state/pty"
99+ end
1010+ if test -d "$session_dir"
1111+ for f in $session_dir/*.json
1212+ if test -f "$f"
1313+ basename $f .json
1414+ end
1515+ end
1616+ end
1717+end
1818+1919+function __pty_needs_command
2020+ set -l cmd (commandline -opc)
2121+ test (count $cmd) -eq 1
2222+end
2323+2424+function __pty_using_command
2525+ set -l cmd (commandline -opc)
2626+ test (count $cmd) -ge 2; and test "$cmd[2]" = "$argv[1]"
2727+end
2828+2929+# Disable file completions by default
3030+complete -c pty -f
3131+3232+# Subcommands
3333+complete -c pty -n __pty_needs_command -a run -d 'Create a session and attach'
3434+complete -c pty -n __pty_needs_command -a attach -d 'Attach to an existing session'
3535+complete -c pty -n __pty_needs_command -a peek -d 'Print current screen or follow output'
3636+complete -c pty -n __pty_needs_command -a send -d 'Send text or keys to a session'
3737+complete -c pty -n __pty_needs_command -a kill -d 'Kill or remove a session'
3838+complete -c pty -n __pty_needs_command -a list -d 'List active sessions'
3939+complete -c pty -n __pty_needs_command -a restart -d 'Restart a session'
4040+complete -c pty -n __pty_needs_command -a help -d 'Show usage information'
4141+4242+# run: flags and file completion for the command argument
4343+complete -c pty -n '__pty_using_command run' -s d -l detach -d 'Create in background'
4444+complete -c pty -n '__pty_using_command run' -s a -l attach -d 'Attach if already running'
4545+complete -c pty -n '__pty_using_command run' -F
4646+4747+# attach: session names and flags
4848+complete -c pty -n '__pty_using_command attach' -a '(__pty_sessions)' -d 'Session'
4949+complete -c pty -n '__pty_using_command attach' -s r -l auto-restart -d 'Auto-restart if exited'
5050+5151+# peek: session names and flags
5252+complete -c pty -n '__pty_using_command peek' -a '(__pty_sessions)' -d 'Session'
5353+complete -c pty -n '__pty_using_command peek' -s f -l follow -d 'Follow output read-only'
5454+complete -c pty -n '__pty_using_command peek' -l plain -d 'Output plain text without ANSI'
5555+5656+# send: session names and flags
5757+complete -c pty -n '__pty_using_command send' -a '(__pty_sessions)' -d 'Session'
5858+complete -c pty -n '__pty_using_command send' -l seq -d 'Send a sequence item' -r
5959+complete -c pty -n '__pty_using_command send' -l with-delay -d 'Delay between --seq items (seconds)' -r
6060+6161+# kill: session names
6262+complete -c pty -n '__pty_using_command kill' -a '(__pty_sessions)' -d 'Session'
6363+6464+# restart: session names and flags
6565+complete -c pty -n '__pty_using_command restart' -a '(__pty_sessions)' -d 'Session'
6666+complete -c pty -n '__pty_using_command restart' -s y -l yes -d 'Skip confirmation'
6767+6868+# list: flags
6969+complete -c pty -n '__pty_using_command list' -l json -d 'Output as JSON'
+5
completions/pty.zsh
···2121 'send:Send text or keys to a session'
2222 'kill:Kill or remove a session'
2323 'list:List active sessions'
2424+ 'ls:List active sessions'
2425 'restart:Restart an exited session'
2526 'help:Show usage information'
2627 )
···5960 _arguments \
6061 '(-y --yes)'{-y,--yes}'[Skip confirmation for running sessions]' \
6162 '1:session:_pty_sessions'
6363+ ;;
6464+ list|ls)
6565+ _arguments \
6666+ '--json[Output as JSON]'
6267 ;;
6368 run)
6469 # After --, fall back to normal (command + file) completion