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

Suggestion: -n flag for string join mirroring string split #8351

Closed
schuelermine opened this issue Oct 14, 2021 · 1 comment · Fixed by #8774
Closed

Suggestion: -n flag for string join mirroring string split #8351

schuelermine opened this issue Oct 14, 2021 · 1 comment · Fixed by #8774

Comments

@schuelermine
Copy link
Contributor

schuelermine commented Oct 14, 2021

There is a flag -n/--no-empty for string split that excludes empty result items.
There should be an analogous flag for string join that does not add the delimiter next to an empty item.

~$ string join -n + a b "" c
   string join + a b "" c
a+b+c
a+b++c
~$ read x; for o in {-n,}
     string join $o -- - a $x (string sub -s 3 $x) b
   end
read> iy
a-iy--b
a-iy-b
@faho
Copy link
Member

faho commented Oct 14, 2021

Yeah, makes sense.

@faho faho added this to the fish-future milestone Oct 14, 2021
joao-vitor-sr added a commit to joao-vitor-sr/fish-shell that referenced this issue Mar 9, 2022
This is an argument that excludes empty result items. Fixes fish-shell#8351
@faho faho linked a pull request Mar 10, 2022 that will close this issue
faho pushed a commit that referenced this issue Mar 13, 2022
* New -n flag for string join command.

This is an argument that excludes empty result items. Fixes #8351

* New documentation for string-join.

The new argument --no-empty was added at string-join manpage.

* New completions for the new -n flag for string join.

* Remove the documentation of the new -n flag of string join0

The reason to remove this new argument in the join0 is that this flag basically doesn't make any difference in the join0.

* Refactor the validation for the string join.

The string join command was using the length of the argument, this commit changes the validation to use the empty function.

* Revert #4b56ab452

The reason for the revert is thath the build broke on the ubuntu in the Github actions.

* Revert #e72e239a1

The reason the compilation on GitHub broke is that the test was weird, it didn't even run it, Common CI systems are typically very very resource-constrained.

* Resolve conflicts in the string-join.rst.

* Resolve conflicts in the "string-join.rst".

commit #1242d0fd7 not fixed all conflicts.
@zanchey zanchey modified the milestones: fish-future, fish 3.5.0 Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants