Add toggle features (Ctrl+G/T), fix bugs, add BATS tests#24
Add toggle features (Ctrl+G/T), fix bugs, add BATS tests#24jellydn wants to merge 24 commits intomieubrisse:mainfrom
Conversation
Replace process substitution < <(...) with temporary file approach to resolve "bad substitution: no closing ')'" error when running cmdk in fish shell. The process substitution syntax is bash-specific and causes parsing errors in fish. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Restored -s flag for recursive directory listing from PR mieubrisse#17 - Combined upstream changes with fish shell compatibility fix - Maintained temporary file approach to avoid bash substitution issues - Preserved proper argument passing for multiple flags 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Temporarily disable 'set -u' around $* expansion to prevent "unbound variable" error when cmdk is called without arguments. Re-enable immediately after the command construction. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Fix all unbound variable errors with array access - Guard array access in cmdk-core.sh to check array length before iteration - Fix argument processing in list-files.sh to handle zero arguments - Make shell scripts executable - Prevents "unbound variable" errors when arrays are empty or no args passed 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added dedicated "Editor Configuration" section with examples - Included setup instructions for Neovim, Cursor, VS Code - Added shell-specific configuration examples for Fish/Bash/Zsh - Removed completed TODO item about customizing file opening 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add -e flag to show gitignored files including .env - Add Ctrl+T hotkey to toggle visibility during selection - Create toggle-state.sh and reload-with-toggle.sh for state management - Update README with usage documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Change shebang from sh to bash for toggle scripts - Fix exit code checking in cmdk-core.sh - Add shellcheck disable comment for intentional word splitting - Use bash instead of sh for consistency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add missing shebang line - Add error handling for cd command - Disable shellcheck warnings for intentional zsh-specific syntax 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- HOME and .. are no longer shown in subdirectories mode (-s) - Users get cleaner output focused only on current directory tree - System mode unchanged, still shows HOME and .. for navigation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Both -o and -s modes now exclude HOME (not relevant for local navigation) - Both modes keep .. for easy parent directory navigation - System mode unchanged with both HOME and .. available 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Hi @mieubrisse, it's ready for your review. Could you please take a look? Thanks! |
|
Hey @jellydn thanks for submitting this! Apologies for the delay (life's been pretty crazy recently); I should be able to get this reviewed tomorrow. Thanks for the patience! |
|
Hi @mieubrisse Do you have the time to review my PR? I'm thinking to send a new one for select file from git. For example, I want to run |
|
oops sorry @jellydn for losing this! things got a little crazy here and I dropped the ball here 🤦♂️ Want to ping me on Discord so we can iterate quickly on this? I want to understand a little more the intent behind some of these. My username is |
Amp-Thread-ID: https://ampcode.com/threads/T-019c301a-46a5-746d-81e4-d27e63d118eb Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c301a-46a5-746d-81e4-d27e63d118eb Co-authored-by: Amp <amp@ampcode.com>
- Capture fzf exit code immediately instead of after cleanup - Replace invalid 'return' with 'exit 1' (script is not sourced) - Add EXIT trap for guaranteed temp file and toggle state cleanup - Validate flags (-o/-s/-e only), reject unknown flags - Check for required tools (fzf, fd, file) at startup Amp-Thread-ID: https://ampcode.com/threads/T-019c3036-2a8f-75cc-849e-4e12ffd77ea6 Co-authored-by: Amp <amp@ampcode.com>
- Fix shebang to bash (script uses arrays and pipefail) - Actually pass home_exclude_args to fd when PWD==HOME - Remove unused script_dirpath and add_back_home_excludes variables Amp-Thread-ID: https://ampcode.com/threads/T-019c3036-2a8f-75cc-849e-4e12ffd77ea6 Co-authored-by: Amp <amp@ampcode.com>
- Fix shebang to bash (script uses pipefail) - Fallback bat→cat, ls --color→ls -G on macOS - Graceful messages for missing tiv/pdftotext/unzip Amp-Thread-ID: https://ampcode.com/threads/T-019c3036-2a8f-75cc-849e-4e12ffd77ea6 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c3036-2a8f-75cc-849e-4e12ffd77ea6 Co-authored-by: Amp <amp@ampcode.com>
- list-files: depth, recursion, spaces, special chars, exclude dirs - git-files: non-git exit, modified/staged/untracked, dedup - toggle-state: init, toggle, get, cleanup, invalid command - preview: text files, directories, HOME keyword Amp-Thread-ID: https://ampcode.com/threads/T-019c3036-2a8f-75cc-849e-4e12ffd77ea6 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c3036-2a8f-75cc-849e-4e12ffd77ea6 Co-authored-by: Amp <amp@ampcode.com>
|
Addressed several codebase concerns from the audit: Bug fixes:
Hardening:
Testing:
|
Amp-Thread-ID: https://ampcode.com/threads/T-019c3036-2a8f-75cc-849e-4e12ffd77ea6 Co-authored-by: Amp <amp@ampcode.com>
|
@mieubrisse I know it's getting bigger on this PR. Let me know your thoughts. Thanks. |
Add Toggle Features, Bug Fixes, Hardening & Tests
Toggle Features
.env, etc.)Bug Fixes
returnused in non-sourced script; no cleanup on Ctrl-C/errorsfd; shebangshbut uses bash arrays/pipefailshbut uses pipefail; no fallbacks for missing toolsA && B || Cis not if-then-else —Ccould run whenAis trueHardening
cmdk-core.sh— only-o,-s,-eaccepted; unknown flags rejectedfzf,fd,fileat startup with actionable error messagespreview.sh(bat→cat, macOSls -G, missingtiv/pdftotext/unzip)Tests
Added 21 BATS tests across 4 files:
test/list-files.bats— depth limiting, recursion, spaces/special chars, exclude dirstest/git-files.bats— non-git exit, modified/staged/untracked, deduptest/toggle-state.bats— init, toggle, get, cleanup, invalid commandtest/preview.bats— text files, directories, HOME keyword