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

feat(env): complete commands and variable assignments #1118

Merged
merged 4 commits into from
Apr 4, 2024
Merged

Conversation

scop
Copy link
Owner

@scop scop commented Feb 26, 2024

Refs #1111

@scop
Copy link
Owner Author

scop commented Feb 26, 2024

Test coverage is likely something to expand before we merge this.

Would be nice to also address --*-signal=SIG too, but that's not a blocker I think.

@scop scop mentioned this pull request Feb 26, 2024
2 tasks
Copy link
Collaborator

@akinomyoga akinomyoga left a comment

Choose a reason for hiding this comment

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

I think we can add tests.

completions/env Outdated Show resolved Hide resolved
@scop scop marked this pull request as draft April 3, 2024 23:56
Refs #1111

Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
@scop scop marked this pull request as ready for review April 4, 2024 10:45
@akinomyoga
Copy link
Collaborator

I added further commits because -* may also be treated as the command name after any variable assignments *=*. For example, in the case of env foo=bar --debug s, --debug is actually treated as the command name by env. Commit 71b7fb2 handles it.

However, I noticed that if we pass the position of --debug to _comp_command_offset, _comp_load produces error messages because it internally checks the command name by type -P "$cmd". So I first fixed _comp_load (and _comp_realcommand, which uses type -P in a similar way) in commit 883946d.

In addition, after the option -- and -, any non-variable-assignment word (including -*) is treated as the command name. Commit 0cd2883 implements the handling of these.

Copy link
Owner Author

@scop scop left a comment

Choose a reason for hiding this comment

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

Nice! Good to go as far as I'm concerned (GH won't let me approve this because I'm the original submitter).

@akinomyoga
Copy link
Collaborator

Thanks!

There are actually similar cases for type -P, but I think we should consider them in another PR.

@scop scop merged commit 23b8144 into master Apr 4, 2024
7 checks passed
@scop scop deleted the feat/env branch April 4, 2024 22:58
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