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

fix: support comments in FZF_DEFAULT_OPTS_FILE by sanitizing content #3960

Closed
wants to merge 1 commit into from
Closed

Conversation

daephx
Copy link

@daephx daephx commented Aug 9, 2024

Added a sanitization step to the FZF_DEFAULT_OPTS_FILE processing, allowing users to include comments in their configuration.

The sanitizer skips empty lines and lines starting with a #, inserting the remaining options into a buffer that will be passed to the parser.

Inline comments are not supported. Additionally, any argument that includes a # should remain unaffected by this change.

Fixes: #3961

Added a sanitization step to the `FZF_DEFAULT_OPTS_FILE` processing,
allowing users to include comments in their configuration.

The sanitizer skips empty lines and lines starting with a `#`, inserting
the remaining options into a buffer that will be passed to the parser.

Inline comments are not supported. Additionally, any argument that
includes a `#` should remain unaffected by this change.
@junegunn
Copy link
Owner

junegunn commented Aug 9, 2024

Thanks, but I'm afraid this won't be able to handle cases like this:

FZF_DEFAULT_OPTS='--header "# world

# peace"'

I wonder if it's possible to extend mattn/go-shellwords to trim comments from the input.

@daephx
Copy link
Author

daephx commented Aug 9, 2024

Ahh, that is rather obscure but understandable. Perhaps I'll go look over there when I get some more time, thanks anyway!

@daephx daephx closed this Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants