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

Adds a simple bash completion script #277

Merged
merged 3 commits into from Jul 25, 2018

Conversation

Projects
None yet
4 participants
@jimschubert
Copy link
Member

jimschubert commented Jun 10, 2018

This works with any loading script named openapi-generator-cli.
That is, if you've installed via homebrew or created a script similar
to https://gist.github.com/jimschubert/ce241b0c78140e364f46914ef8ec4103

This script is relatively simple, relying on fallback to the recently
add "completion" command to the CLI project.

The script includes a possible extension to allow for per-language
options to autocomplete when the user is applying additional properties.
This work is currently commented out, as it may be simplified a bit in
the CLI first.

To evaluate, you'll need the script from the gist mentioned above saved somewhere on your path and made executable (chmod u+x openapi-generator-cli). Then install bash completions if you don't already have it installed:

brew install bash-completion

Rather than permanently installing the completion script, you can just source it in your current shell session:

source openapi-generator-cli-completion.bash

Now you can TABTAB for autocomplete suggestions.

@wing328 we'll want to add this to homebrew, but this will only be available after the next artifact is released.

see #214

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

(details of the change, additional tests that have been done, reference to the issue for tracking, etc)

Adds a simple bash completion script
This works with any loading script named openapi-generator-cli.
That is, if you've installed via homebrew or created a script similar
to https://gist.github.com/jimschubert/ce241b0c78140e364f46914ef8ec4103

This script is relatively simple, relying on fallback to the recently
add "completion" command to the CLI project.

The script includes a possible extension to allow for per-language
options to autocomplete when the user is applying additional properties.
This work is currently commented out, as it may be simplified a bit in
the CLI first.

@jimschubert jimschubert requested a review from wing328 Jun 10, 2018

@wing328 wing328 added this to the 3.0.2 milestone Jun 12, 2018

@jmini jmini modified the milestones: 3.0.2, 3.0.3 Jun 18, 2018

@wing328

This comment has been minimized.

Copy link
Member

wing328 commented Jun 21, 2018

Shall we add openapi-generator-cli.sh under ./bin/utils as well?

@ackintosh ackintosh modified the milestones: 3.0.3, 3.1.0 Jun 27, 2018

@wing328 wing328 modified the milestones: 3.1.0, 3.1.1 Jul 6, 2018

@jimschubert

This comment has been minimized.

Copy link
Member Author

jimschubert commented Jul 7, 2018

@wing328 we could, but I think the script would need some touching up (like make it so that it queries the latest tag from github as the default version). It's unrelated to the bash completions in this PR, so I wouldn't wait on me updating that script to merge this PR.

@jimschubert

This comment has been minimized.

Copy link
Member Author

jimschubert commented Jul 7, 2018

@wing328 I've modified https://gist.github.com/jimschubert/ce241b0c78140e364f46914ef8ec4103 to pull (or reuse) the latest released tag by default. Let me know what you think, and I can add it to this PR.

@jimschubert

This comment has been minimized.

Copy link
Member Author

jimschubert commented Jul 7, 2018

@wing328 I went ahead and added that launcher script. It's a great idea, and updating it wasn't as complicated as I thought it would be.

@wing328

This comment has been minimized.

Copy link
Member

wing328 commented Jul 8, 2018

@jimschubert thanks. I'll give it a try tomorrow and merge accordingly.

@jmini jmini modified the milestones: 3.1.1, 3.1.2 Jul 18, 2018

@wing328 wing328 merged commit c6004a8 into OpenAPITools:master Jul 25, 2018

3 of 4 checks passed

Shippable Run 1562 status is FAILED.
Details
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jimschubert jimschubert deleted the jimschubert:bash-completion-script branch Aug 12, 2018

A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019

Adds a simple bash completion script (OpenAPITools#277)
* Adds a simple bash completion script

This works with any loading script named openapi-generator-cli.
That is, if you've installed via homebrew or created a script similar
to https://gist.github.com/jimschubert/ce241b0c78140e364f46914ef8ec4103

This script is relatively simple, relying on fallback to the recently
add "completion" command to the CLI project.

The script includes a possible extension to allow for per-language
options to autocomplete when the user is applying additional properties.
This work is currently commented out, as it may be simplified a bit in
the CLI first.

* Add launcher script and "install" instructions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.