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

Change default delimiter #915

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kit494way
Copy link
Contributor

Currently, the default delimiter is two or more white space characters.
The default delimiter should be one or more white space characters.

@denisidoro
Copy link
Owner

Won't this break commands with a single space?

@kit494way
Copy link
Contributor Author

kit494way commented Sep 26, 2024

After re-reading the code, I realized that this change could affect more than just the intended part.
My intention is to omit redundant --delimiter options for variables.
My use cases are here.

% gh

# download release asset
gh release download <release_tag> -R <release_repo> -p <asset_pattern>

$ release_tag: gh release list -R <release_repo> --exclude-pre-releases --exclude-drafts --json tagName,publishedAt --jq '.[] | [.tagName, .publishedAt] | @tsv' --- --column 1 --delimiter '\t'
$ asset_pattern: gh release view -R <release_repo> --json assets --jq '.assets[].name'
% mise

# use local
mise use <tool>@<version>

$ tool: mise plugins ls -c --user -q
$ version: join -a 1 <(mise ls-remote <tool> | sort) <(mise ls -i <tool> | awk '{print $2 "\t*"}' | sort) | sort -k 1 -Vr --- --column 1 --delimiter "\s+"

The first time I tried to use the --column option without the --delimiter, I was confused.
This is because I expected the default delimiter to be something like \s+.
In my opinion, \s+ is more common than \s\s+ as the delimiter.
Currently, when I use the --column option, I always specify the --delimiter, which I find redundant.

After reconsideration, I think the following change would better fit the intent of changing the default delimiter for variables.

diff --git a/src/finder/structures.rs b/src/finder/structures.rs
index a055194..231ff06 100644
--- a/src/finder/structures.rs
+++ b/src/finder/structures.rs
@@ -66,6 +66,7 @@ impl Opts {
             overrides: CONFIG.fzf_overrides_var(),
             suggestion_type: SuggestionType::SingleRecommendation,
             prevent_select1: false,
+            delimiter: Some(r"\s+".to_string()),
             ..Default::default()
         }
     }

change here

Is this OK?

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