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

Tweak Zsh completions and allow completion on ports tree #652

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

Conversation

Jehops
Copy link
Member

@Jehops Jehops commented Nov 7, 2018

There is one annoyance. For options that expect an argument, if the user hits a space before trying to complete, zsh completes on both the argument and a ports tree. For example, if the user enters poudriere bulk -j then hits TAB, then zsh will only complete on jails, but if the user enters poudriere bulk -j , then zsh will complete both the jails and ports. Other than that all seems to be working well. If you do consider this useful, it might be best to wait a few days, so I can test more. I open the PR now, in case there are any changes to discuss.

@Jehops
Copy link
Member Author

Jehops commented Nov 16, 2018

So far, so good. It seems to work well.

@bdrewery
Copy link
Member

bdrewery commented Feb 8, 2019

Can you explain in your commit, or split into two, the various changes beyond the ports tree change? Also your commit still says "wip".

@Jehops Jehops force-pushed the ports_completion branch 2 times, most recently from 59c57f2 to a196398 Compare February 9, 2019 16:56
@Jehops Jehops changed the title zsh completions: wip to complete specific ports in a tree Update Zsh completions and allow completion on ports tree Feb 9, 2019
@Jehops
Copy link
Member Author

Jehops commented Feb 9, 2019

I updated the commit and included a description of the two types of changes in the commit log.

  1. The first change ensures that mutually exclusive options are completed properly. For example, if -a is included with poudriere bulk, then -f or a ports tree should not be completed.

  2. Specifying mandatory option arguments correctly fixes the annoyance that I described in the original comment.

@Jehops Jehops changed the title Update Zsh completions and allow completion on ports tree Tweak Zsh completions and allow completion on ports tree Feb 9, 2019
@bdrewery
Copy link
Member

Hmm now it seems completions don't require any - flags. Like testport still needs a -j but it jumps right to ports:

~/git/poudriere3 # poudriere testport
Keywords/       accessibility/  audio/          cad/            databases/      dns/            french/         graphics/       japanese/       mail/           net/            news/           ports-mgmt/     science/        textproc/       x11/            x11-fonts/      x11-wm/
Mk/             arabic/         base/           chinese/        deskutils/      editors/        ftp/            hebrew/         java/           math/           net-im/         packages/       portuguese/     security/       ukrainian/      x11-clocks/     x11-servers/   
Templates/      archivers/      benchmarks/     comms/          devel/          emulators/      games/          hungarian/      korean/         misc/           net-mgmt/       palm/           print/          shells/         vietnamese/     x11-drivers/    x11-themes/
Tools/          astro/          biology/        converters/     distfiles/      finance/        german/         irc/            lang/           multimedia/     net-p2p/        polish/         russian/        sysutils/       www/            x11-fm/         x11-toolkits/

@bdrewery
Copy link
Member

bdrewery commented Feb 27, 2019

And using -p <other> didn't grab the ports... (edit removed a bogus issue)

@bdrewery
Copy link
Member

What's the sane way to reload the completions when replacing the _poudriere file?

@Jehops
Copy link
Member Author

Jehops commented Feb 27, 2019

Hmm now it seems completions don't require any - flags. Like testport still needs a -j but it jumps right to ports:

Sorry, I didn't catch that poudriere testport cat/port -j <jail> was not valid syntax. For testport if -o is not specified than I will ensure that -j <jail> is specified before cat/part. I will also take another look at the other commands.

Note that if you hit a - first, then the -* options are completed.

@bdrewery
Copy link
Member

The -j problem is on bulk too. In general the ports are expected to come last. The -o flag for testport is not even needed. It's an accident of history.

@Jehops
Copy link
Member Author

Jehops commented Apr 5, 2019

What's the sane way to reload the completions when replacing the _poudriere file?

rehash seems to work. Apparently this only works if you haven't unset the hash_list_all option though.

I hope to take another go at this soon.

- Ensure that mutually exclusive options are not both completed. For
  example, in the '-a' specification for the 'bulk' action shown below,
  the (-f *) indicates that if '-a' has been specified, then do not
  complete either '-f' or a ports tree.

         '(-f *)-a[build the whole ports tree]'

- Ensure that mandatory arguments are properly completed. For example, in
  the '-p' specifications show below, in the first form, the ports tree is
  optional and in the second form it is mandatory.

        -p+[specifies which ports tree to use]::tree:_poudriere_pt
        -p+[specifies which ports tree to use]:tree:_poudriere_pt
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