fix(cable): quote shell arguments and fix line endings for linux files (#619)

## 📺 PR Description

Fixes #616 
Added quotes to prevent shell argument escape

## Checklist

<!-- a quick pass through the following items to make sure you haven't
forgotten anything -->

- [x] my commits **and PR title** follow the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format
- [ ] if this is a new feature, I have added tests to consolidate the
feature and prevent regressions
- [ ] if this is a bug fix, I have added a test that reproduces the bug
(if applicable)
- [ ] I have added a reasonable amount of documentation to the code
where appropriate
This commit is contained in:
LM 2025-07-10 12:38:02 +02:00 committed by GitHub
parent b2c43539ff
commit 177ac79bcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 102 additions and 100 deletions

View File

@ -7,7 +7,7 @@ requirements = ["fd"]
command = ["fd -t d", "fd -t d --hidden"]
[preview]
command = "ls -la --color=always {}"
command = "ls -la --color=always '{}'"
[keybindings]
shortcut = "f2"

View File

@ -1,13 +1,13 @@
# UNTESTED
[metadata]
name = "docker-images"
description = "A channel to select from Docker images"
requirements = ["docker", "jq"]
[source]
command = "docker images --format '{{.Repository}}:{{.Tag}} {{.ID}}'"
output = "{split: :-1}"
[preview]
command = "docker image inspect {split: :-1} | jq -C"
# UNTESTED
[metadata]
name = "docker-images"
description = "A channel to select from Docker images"
requirements = ["docker", "jq"]
[source]
command = "docker images --format '{{.Repository}}:{{.Tag}} {{.ID}}'"
output = "{split: :-1}"
[preview]
command = "docker image inspect '{split: :-1}' | jq -C"

View File

@ -1,14 +1,14 @@
[metadata]
name = "files"
description = "A channel to select files and directories"
requirements = ["fd", "bat"]
[source]
command = ["fd -t f", "fd -t f -H"]
[preview]
command = "bat -n --color=always '{}'"
env = { BAT_THEME = "ansi" }
[keybindings]
shortcut = "f1"
[metadata]
name = "files"
description = "A channel to select files and directories"
requirements = ["fd", "bat"]
[source]
command = ["fd -t f", "fd -t f -H"]
[preview]
command = "bat -n --color=always '{}'"
env = { BAT_THEME = "ansi" }
[keybindings]
shortcut = "f1"

View File

@ -1,11 +1,11 @@
[metadata]
name = "git-branch"
description = "A channel to select from git branches"
requirements = ["git"]
[source]
command = "git --no-pager branch --all --format=\"%(refname:short)\""
output = "{split: :0}"
[preview]
command = "git show -p --stat --pretty=fuller --color=always {0}"
[metadata]
name = "git-branch"
description = "A channel to select from git branches"
requirements = ["git"]
[source]
command = "git --no-pager branch --all --format=\"%(refname:short)\""
output = "{split: :0}"
[preview]
command = "git show -p --stat --pretty=fuller --color=always '{0}'"

View File

@ -1,10 +1,10 @@
[metadata]
name = "git-diff"
description = "A channel to select files from git diff commands"
requirements = ["git"]
[source]
command = "git diff --name-only HEAD"
[preview]
command = "git diff HEAD --color=always -- {}"
[metadata]
name = "git-diff"
description = "A channel to select files from git diff commands"
requirements = ["git"]
[source]
command = "git diff --name-only HEAD"
[preview]
command = "git diff HEAD --color=always -- '{}'"

View File

@ -1,11 +1,11 @@
[metadata]
name = "git-log"
description = "A channel to select from git log entries"
requirements = ["git"]
[source]
command = "git log --oneline --date=short --pretty=\"format:%h %s %an %cd\" \"$@\""
output = "{split: :0}"
[preview]
command = "git show -p --stat --pretty=fuller --color=always {0}"
[metadata]
name = "git-log"
description = "A channel to select from git log entries"
requirements = ["git"]
[source]
command = "git log --oneline --date=short --pretty=\"format:%h %s %an %cd\" \"$@\""
output = "{split: :0}"
[preview]
command = "git show -p --stat --pretty=fuller --color=always '{0}'"

View File

@ -1,11 +1,11 @@
[metadata]
name = "git-reflog"
description = "A channel to select from git reflog entries"
requirements = ["git"]
[source]
command = "git reflog"
output = "{split: :0}"
[preview]
command = "git show -p --stat --pretty=fuller --color=always {0}"
[metadata]
name = "git-reflog"
description = "A channel to select from git reflog entries"
requirements = ["git"]
[source]
command = "git reflog"
output = "{split: :0}"
[preview]
command = "git show -p --stat --pretty=fuller --color=always '{0}'"

View File

@ -9,8 +9,8 @@ This channel uses `fd` to find directories that contain a `.git` subdirectory, a
[source]
# this is a macos version of the command. While perfectly usable on linux, you may want to tweak it a bit.
command = "fd -g .git -HL -t d -d 10 --prune ~ -E 'Library' -E 'Application Support' --exec dirname {}"
command = "fd -g .git -HL -t d -d 10 --prune ~ -E 'Library' -E 'Application Support' --exec dirname '{}'"
display = "{split:/:-1}"
[preview]
command = "cd {}; git log -n 200 --pretty=medium --all --graph --color"
command = "cd '{}'; git log -n 200 --pretty=medium --all --graph --color"

View File

@ -1,17 +1,18 @@
[metadata]
name = "text"
description = "A channel to find and select text from files"
requirements = ["rg", "bat"]
[source]
command = "rg . --no-heading --line-number"
display = "[{split:\\::..2}]\t{split:\\::2}"
output = "{split:\\::..2}"
[preview]
command = 'bat -n --color=always {split:\::0}'
env = { BAT_THEME = "ansi" }
offset = '{split:\::1}'
[ui]
preview_panel = { header = '{split:\::..2}' }
[metadata]
name = "text"
description = "A channel to find and select text from files"
requirements = ["rg", "bat"]
[source]
command = "rg . --no-heading --line-number"
display = "[{split:\\::..2}]\t{split:\\::2}"
output = "{split:\\::..2}"
[preview]
command = "bat -n --color=always '{split:\\::0}'"
env = { BAT_THEME = "ansi" }
offset = '{split:\::1}'
[ui]
preview_panel = { header = '{split:\::..2}' }

View File

@ -7,7 +7,7 @@ requirements = ["fd"]
command = ["fd -t d", "fd -t d --hidden"]
[preview]
command = "ls -l {}"
command = "ls -l '{}'"
[keybindings]
shortcut = "f2"

View File

@ -10,4 +10,4 @@ output = "{split: :-1}"
[preview]
command = "docker image inspect {split: :-1} | jq -C"
command = "docker image inspect '{split: :-1}' | jq -C"

View File

@ -8,4 +8,4 @@ command = "fd -t f . \"$env:USERPROFILE\\AppData\\Roaming\\\""
[preview]
command = "bat -n --color=always {}"
command = "bat -n --color=always '{}'"

View File

@ -7,7 +7,7 @@ requirements = ["fd", "bat"]
command = ["fd -t f", "fd -t f -H"]
[preview]
command = "bat -n --color=always {}"
command = "bat -n --color=always '{}'"
env = { BAT_THEME = "ansi" }
[keybindings]

View File

@ -8,4 +8,4 @@ command = "git --no-pager branch --all --format=\"%(refname:short)\""
output = "{split: :0}"
[preview]
command = "git show -p --stat --pretty=fuller --color=always {0}"
command = "git show -p --stat --pretty=fuller --color=always '{0}'"

View File

@ -7,4 +7,4 @@ requirements = ["git"]
command = "git diff --name-only HEAD"
[preview]
command = "git diff HEAD --color=always -- {}"
command = "git diff HEAD --color=always -- '{}'"

View File

@ -8,4 +8,4 @@ command = "git log --oneline --date=short --pretty=\"format:%h %s %an %cd\""
output = "{split: :0}"
[preview]
command = "git show -p --stat --pretty=fuller --color=always {0}"
command = "git show -p --stat --pretty=fuller --color=always '{0}'"

View File

@ -8,4 +8,4 @@ command = "git reflog"
output = "{split: :0}"
[preview]
command = "git show -p --stat --pretty=fuller --color=always {0}"
command = "git show -p --stat --pretty=fuller --color=always '{0}'"

View File

@ -9,9 +9,10 @@ display = "[{split:\\::..2}]\t{split:\\::2}"
output = "{split:\\::..2}"
[preview]
command = 'bat -n --color=always {split:\::0}'
command = "bat -n --color=always '{split:\\::0}'"
env = { BAT_THEME = "ansi" }
offset = '{split:\::1}'
[ui]
preview_panel = { header = '{split:\::..2}' }
preview_panel = { header = '{split:\::..2}' }