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

Add pkgng command completions #2395

Closed

Conversation

KamilaBorowska
Copy link
Contributor

Fixes #1054.

@faho
Copy link
Member

faho commented Sep 16, 2015

I think we've noticed everything. Here's a list of my criticism (with obsolete points stricken):

  • Options-before-commands (pkg --rootdir $path add $package)
  • Redundant descriptions ("Package")
  • Incompleteness (can also be done later since this seems to cover most cases already)
  • Unnecessary version
  • Inhibiting fuzzyness

Merge when you feel it's okay - though I'd suggest squashing.

@KamilaBorowska
Copy link
Contributor Author

@faho: Okay, I think I fixed the thing about "options-before-commands" (although option parsers are really complex).

(and thinking about it, I found a flaw in my code about code like -4c, but eh, this could be difficult to deal with within fish shell framework, and I don't think many people would do that)

@faho
Copy link
Member

faho commented Sep 16, 2015

Yeah, this should work. If you're confident, merge!

@faho
Copy link
Member

faho commented Sep 16, 2015

(and thinking about it, I found a flaw in my code about code like -4c, but eh, this could be difficult to deal with within fish shell framework, and I don't think many people would do that)

Depends on how pkg handles this - if it only recognizes arg-needing options as the last in the group (i.e. "-4c" is okay, "-c4" isn't), then you can just add another "*" - case -\*{o,j,c,r,C,R}

@KamilaBorowska
Copy link
Contributor Author

@faho: -c4 is okay, it's a single parameter, -c with argument 4, while -4c is two parameters, -4 and -c, and it awaits a value for -c.

Doing something like that would break stuff like -jjailc, as in this case c is not a parameter.

@KamilaBorowska
Copy link
Contributor Author

Merged with squash in any case (although I didn't notice your code comment until too late).

(it was a while since I did anything in fish shell)

@faho
Copy link
Member

faho commented Sep 16, 2015

So it's like:

  • If an option group ends with an option that takes an argument, we need to skip the next arg
  • If an option that takes an arg is anywhere else, it takes the rest of the group as argument (or only the next letter)

Well, this is a bit quirky but should be doable.

@faho
Copy link
Member

faho commented Sep 16, 2015

Merged with squash in any case (although I didn't notice your code comment until too late).

Yeah but you seem to have fixed it right away. Nice work!

@faho
Copy link
Member

faho commented Sep 16, 2015

If an option group ends with an option that takes an argument, we need to skip the next arg

This should almost work just by adding another "*" between the "-" and the argument-taking shortopts like I commented above: case -\*{o,j,c,r,C,R}. The only part that wouldn't be working is if you have an argument-taking opt and an argument to that that looks like an argument-taking opt in the same group (e.g. "-cr"). I'd be okay with that since it seems like all argument-taking opts take directories, so the edge-case is only triggered if the user wants to use a directory named "r" or similar.

@KamilaBorowska
Copy link
Contributor Author

@faho: Option -j is a jail identifier.

(and by the same logic, it's unlikely the user will want to use even one option, not to say many of those global options, considering they are quite unusual options to use)

@faho
Copy link
Member

faho commented Sep 16, 2015

Option -j is a jail identifier.

Which doesn't make much of a difference - or is "c" or "R" a typical jail identifier?

If you want, fix it, if not, okay.

@KamilaBorowska
Copy link
Contributor Author

@faho: No, but darthvader may be a jail identifier. -jdarthvader is fine.

@faho
Copy link
Member

faho commented Sep 16, 2015

Yeah, you're right.

@zanchey zanchey added this to the next-2.x milestone Sep 25, 2015
@faho faho added the release notes Something that is or should be mentioned in the release notes label Oct 26, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
completions enhancement release notes Something that is or should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add pkgng completion
3 participants