Skip to content

Commit 3846023

Browse files
Kobaruoncursoragent
authored andcommitted
feat: add fish shell completions and integration
Add fish completion/install wiring so fish users get the same peon command UX as bash/zsh. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent eba23a6 commit 3846023

5 files changed

Lines changed: 52 additions & 1 deletion

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.0
1+
1.4.1

completions.fish

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# peon-ping tab completion for fish shell
2+
3+
# Top-level options (no repeated suggestions)
4+
complete -c peon -f
5+
complete -c peon -l pause -d "Pause sound notifications"
6+
complete -c peon -l resume -d "Resume sound notifications"
7+
complete -c peon -l toggle -d "Toggle sound notifications"
8+
complete -c peon -l status -d "Show current status"
9+
complete -c peon -l packs -d "List available sound packs"
10+
complete -c peon -l pack -d "Switch active sound pack" -r -a "(
11+
set -l packs_dir (set -q CLAUDE_PEON_DIR; and echo \$CLAUDE_PEON_DIR; or echo \$HOME/.claude/hooks/peon-ping)/packs
12+
if test -d \$packs_dir
13+
for manifest in \$packs_dir/*/manifest.json
14+
basename (dirname \$manifest)
15+
end
16+
end
17+
)"
18+
complete -c peon -l help -d "Show help message"

install.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ if [ -n "$SCRIPT_DIR" ]; then
127127
cp -r "$SCRIPT_DIR/packs/"* "$INSTALL_DIR/packs/"
128128
cp "$SCRIPT_DIR/peon.sh" "$INSTALL_DIR/"
129129
cp "$SCRIPT_DIR/completions.bash" "$INSTALL_DIR/"
130+
cp "$SCRIPT_DIR/completions.fish" "$INSTALL_DIR/"
130131
cp "$SCRIPT_DIR/VERSION" "$INSTALL_DIR/"
131132
cp "$SCRIPT_DIR/uninstall.sh" "$INSTALL_DIR/"
132133
if [ "$UPDATING" = false ]; then
@@ -137,6 +138,7 @@ else
137138
echo "Downloading from GitHub..."
138139
curl -fsSL "$REPO_BASE/peon.sh" -o "$INSTALL_DIR/peon.sh"
139140
curl -fsSL "$REPO_BASE/completions.bash" -o "$INSTALL_DIR/completions.bash"
141+
curl -fsSL "$REPO_BASE/completions.fish" -o "$INSTALL_DIR/completions.fish"
140142
curl -fsSL "$REPO_BASE/VERSION" -o "$INSTALL_DIR/VERSION"
141143
curl -fsSL "$REPO_BASE/uninstall.sh" -o "$INSTALL_DIR/uninstall.sh"
142144
for pack in $PACKS; do
@@ -213,6 +215,24 @@ if [ "$LOCAL_MODE" = false ]; then
213215
done
214216
fi
215217

218+
# --- Add fish shell function + completions ---
219+
FISH_CONFIG="$HOME/.config/fish/config.fish"
220+
if [ -f "$FISH_CONFIG" ]; then
221+
FISH_FUNC='function peon; bash ~/.claude/hooks/peon-ping/peon.sh $argv; end'
222+
if ! grep -qF 'function peon' "$FISH_CONFIG"; then
223+
echo "" >> "$FISH_CONFIG"
224+
echo "# peon-ping quick controls" >> "$FISH_CONFIG"
225+
echo "$FISH_FUNC" >> "$FISH_CONFIG"
226+
echo "Added peon function to config.fish"
227+
fi
228+
fi
229+
FISH_COMPLETIONS_DIR="$HOME/.config/fish/completions"
230+
if [ -d "$HOME/.config/fish" ]; then
231+
mkdir -p "$FISH_COMPLETIONS_DIR"
232+
cp "$INSTALL_DIR/completions.fish" "$FISH_COMPLETIONS_DIR/peon.fish"
233+
echo "Installed fish completions to $FISH_COMPLETIONS_DIR/peon.fish"
234+
fi
235+
216236
# --- Verify sounds are installed ---
217237
echo ""
218238
for pack in $PACKS; do

tests/install.bats

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ setup() {
1616
cp "$(dirname "$BATS_TEST_FILENAME")/../config.json" "$CLONE_DIR/"
1717
cp "$(dirname "$BATS_TEST_FILENAME")/../VERSION" "$CLONE_DIR/"
1818
cp "$(dirname "$BATS_TEST_FILENAME")/../completions.bash" "$CLONE_DIR/"
19+
cp "$(dirname "$BATS_TEST_FILENAME")/../completions.fish" "$CLONE_DIR/"
1920
cp "$(dirname "$BATS_TEST_FILENAME")/../uninstall.sh" "$CLONE_DIR/" 2>/dev/null || touch "$CLONE_DIR/uninstall.sh"
2021
cp -r "$(dirname "$BATS_TEST_FILENAME")/../packs" "$CLONE_DIR/"
2122
cp -r "$(dirname "$BATS_TEST_FILENAME")/../skills" "$CLONE_DIR/" 2>/dev/null || true
@@ -180,3 +181,8 @@ print('OK')
180181
[[ "$output" == *".claude/ not found"* ]]
181182
rm -rf "$NO_CLAUDE_DIR"
182183
}
184+
185+
@test "fresh install copies completions.fish" {
186+
bash "$CLONE_DIR/install.sh"
187+
[ -f "$INSTALL_DIR/completions.fish" ]
188+
}

uninstall.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ print('Restored notify.sh hooks for: SessionStart, UserPromptSubmit, Stop, Notif
109109
fi
110110
fi
111111

112+
# --- Remove fish completions ---
113+
FISH_COMPLETIONS="$HOME/.config/fish/completions/peon.fish"
114+
if [ -f "$FISH_COMPLETIONS" ]; then
115+
rm "$FISH_COMPLETIONS"
116+
echo "Removed fish completions"
117+
fi
118+
112119
# --- Remove skill directory ---
113120
SKILL_DIR="$BASE_DIR/skills/peon-ping-toggle"
114121
if [ -d "$SKILL_DIR" ]; then

0 commit comments

Comments
 (0)