Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: support arguments containing whitespace without needing to escape the quotes #20

Open
benelan opened this issue May 18, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@benelan
Copy link
Owner

benelan commented May 18, 2024

Description

Currently all quotes in the arguments passed to gh fzf need to be escaped. For example, with gh, you can do:

gh issue list -S 'label:"known issue" milestone:"back burner"'

However, you need to escape the quotes to view that list with gh fzf, which shouldn't be a requirement:

gh fzf issue -S \'label:\"known issue\" milestone:\"back burner\"\'

This limitation is mentioned in the README's usage section, or else it would be a bug instead of an enhancement.

Acceptance Criteria

Arguments can be passed to gh fzf in the same format they are passed to gh, e.g. without escaping quotes.

Relevant Info

The quotes need to be escaped because the arguments are saved in the FZF_DEFAULT_COMMAND environment variable, which is how the list reloading and filtering works. This follows an example from fzf's readme.

I attempted to escape the quotes with printf:

escape() { printf "%q" "$@"; }

This worked for simple use cases, but not ones where quotes are nested like the example in the description.

This is a shell quirk, so I will probably need to do a golang rewrite to fix the issue.

@benelan benelan added the enhancement New feature or request label May 18, 2024
@benelan benelan self-assigned this May 18, 2024
@benelan benelan changed the title Feat: support arguments containing whitespace without needing to escape the quotes Feature: support arguments containing whitespace without needing to escape the quotes May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant