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

Support for arg-desc element in option maps to complete-getopt #693

Merged
merged 1 commit into from Jun 5, 2018

Conversation

Projects
None yet
2 participants
@zzamboni
Contributor

zzamboni commented Jun 5, 2018

If arg-desc is present, it gets added to the completion's display suffix, but outside the parenthesis. I.e.:

[&long=select &short=s &arg-desc="<type>" &desc="Select items"]

produces the following completion items:

▶ (edit:complex-candidate -s &code-suffix='' &display-suffix=' <type> (Select items)' &style='')
▶ (edit:complex-candidate --select &code-suffix='' &display-suffix=' <type> (Select items)' &style='')

I couldn't find any existing tests for complGetopt so I didn't know where to add tests for this - feel free to point me in the right direction.

Support for arg-desc element in option maps to complete-getopt
If arg-desc is present, it gets added to the completion's display
suffix, but outside the parenthesis. I.e.:

    [&long=select &short=s &arg-desc="<type>" &desc="Select items"]

produces the following completion items:

    ▶ (edit:complex-candidate -s &code-suffix='' &display-suffix=' <type> (Select items)' &style='')
    ▶ (edit:complex-candidate --select &code-suffix='' &display-suffix=' <type> (Select items)' &style='')

@xiaq xiaq merged commit 7cad228 into elves:master Jun 5, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

zzamboni added a commit to zzamboni/elvish-completions that referenced this pull request Jun 5, 2018

Multiple improvements to comp:extract-opts and option handling
- extract-opts is now fully configurable both in regex and regex-map -
  only fields present in regex-map are extracted.
- The default regex/regex-map now captures common formats for option
  arguments and their descriptions, and tries to determine from the
  format if the argument is mandatory or optional. Based on this, the
  corresponding arg-mandatory or arg-optional field is set to
  $true. In any case, if an option argument is detected, arg-desc is
  set to its captured description (required
  elves/elvish#693 for proper handling of
  arg-desc, but will work fine in previous builds, only without
  displaying arg-desc)
- New option &fold (default $false), if $true, preprocess input lines
  to join descriptions that span to the next line (only joins one
  additional line at the moment)
- Updated documentation and examples.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment