Skip to content

[WIP] Array utilities#953

Draft
akinomyoga wants to merge 13 commits into
scop:mainfrom
akinomyoga:ARRAY
Draft

[WIP] Array utilities#953
akinomyoga wants to merge 13 commits into
scop:mainfrom
akinomyoga:ARRAY

Conversation

@akinomyoga

Copy link
Copy Markdown
Collaborator

I decided to move code stubs for array utilities in #739 and #950 to here.

I guess this could end up as an invalid regex if _parse_help lets any strings through to main_cmd that make it so. The previous implementation had the same issue though, so not a regression. Leaving up to you to decide whether to address or merge as is.

Some array utilities would be nice to help with cases like this. I have this ages old unfinished patch for the main bash_completion in my stash, probably broken in the first place and uses namerefs so requires bash >= 4.3, but to illustrate what I was thinking back $then

+_bashcomp_uniq()
[...]
+_bashcomp_last_index() {
[...]
+_bashcomp_compact() {
[...]
+_bashcomp_index_of() {
[...]

Originally posted by @scop in #950 (comment)

  • bc6f87d This implements a function _comp_array_filter. I'm not sure whether Ville would finally find it reasonable to include the function in bash-completion, but I tried to make the interface minimal (one function _comp_array_filter) yet make the function versatile as @calestyo would be likely to request. In any way, this function can be used for the array manipulations of general cases.

Originally posted by @akinomyoga in #739 (comment)

@akinomyoga

Copy link
Copy Markdown
Collaborator Author

Ref #432

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if the intent is to leave this as a separate file, but I suppose we could think of shipping it in startup-core now.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'm not sure if we would finally include those utilities. Currently, those functions are placed in completions-core/ARRAY.bash experimentally so that they can be loaded through _comp_xfunc for delayed loading. However, they might be put in helpers-core with a new mechanism of helper autoloader.

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