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

jimschubert
Copy link
Member

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)

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 June 10, 2018 20:43
@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
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
Copy link
Member Author

@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
Copy link
Member Author

@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
Copy link
Member Author

@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
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
@jimschubert jimschubert deleted the bash-completion-script branch August 12, 2018 02:11
A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
* 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
nilskuhn pushed a commit to nilskuhn/openapi-generator that referenced this pull request Apr 6, 2023
…commitlint-monorepo

chore(deps): update commitlint monorepo to v12 (major)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants