-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[cli] Completions command for suggestions #213
[cli] Completions command for suggestions #213
Conversation
This takes airlift's 'suggest' command and reuses it as a different command name, 'completion'. This gives us in-built CLI completions which are useful in the repo-level container's docker-entrypoint.sh. This previously parsed Java files for conventional usage of Command annotations, which is potentially buggy. The new implementation relies only on CLI to provide command completion suggestions. As part of this, we can prepare for bash completion scripts which can be added to our homebrew formula. The new completion command will also complete on command options, for example: cli completion generate This will provide all short and long form switches available to the generate command.
@@ -0,0 +1,99 @@ | |||
/* | |||
* Copyright (C) 2010 the original author or authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we update the above with the following instead?
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wing328 we can't. Per comment below the header, I took this from the framework's suggest command and renamed it with a description. It's unfortunate that they have such a generic license text, because it makes it look like something that needs to be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, or do you think we should add our line as a second line in the header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wing328 I've added
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
Below the line you've commented on, as this licensed file is originally from airlift/airline, not SmartBear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
@jimschubert the enhancement looks awesome. I'll give it a try tomorrow and let you know if I've any feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally and it works fine for me
* master: (26 commits) Prepare 3.0.1 release (OpenAPITools#280) [typescript-angular] strict type checking (OpenAPITools#218) [C++ server] Adjust the names (script, sample folder, generator) to lang option (OpenAPITools#250) Removed warnings for packages included in SDK for Net Core 2.0 (OpenAPITools#269) [cli] Completions command for suggestions (OpenAPITools#213) [Java][RestTemplate] Fix query parameter URL encoding (OpenAPITools#260) [cpp-qt5] Remove std::shared_ptr from Qt5 (OpenAPITools#267) Adds some links to the README (OpenAPITools#261) Update sec.gpg.enc to binary encoded secret Add gpg --check-trustdb, limit gpg to master Re-do encrypted gpg and reference in settings.xml Fix trailing semicolons in after_success Travis CI scripts Use ubuntu keyserver instead of mit (due to timeout) [gradle] Plugin release management (OpenAPITools#201) Updates small typo in qna.md (OpenAPITools#262) Fix ModelUtils.getUnusedSchema() (OpenAPITools#253) Add JaxRS to bin/ensure-up-to-date (OpenAPITools#248) feat(security): add cookie-auth support (OpenAPITools#240) Add 'unblu inc.' to company list (OpenAPITools#246) put company list in alphabetical order (OpenAPITools#244) ...
This takes airlift's 'suggest' command and reuses it as a different
command name, 'completion'. This gives us in-built CLI completions which
are useful in the repo-level container's docker-entrypoint.sh. This
previously parsed Java files for conventional usage of Command
annotations, which is potentially buggy. The new implementation relies
only on CLI to provide command completion suggestions.
As part of this, we can prepare for bash completion scripts which can be
added to our homebrew formula. The new completion command will also
complete on command options, for example:
This will provide all short and long form switches available to the
generate command.
Example (commands available globally):
Example (switches available to
generate
command):Example (switches available to
meta
command):This also moves the exit code of 1 for executing the CLI with no args to after the
run
call, allowing CLI to execute the default command before exiting as an error./cc @jmini @wing328 (I don't know who is considered technical committee for CLI, maven plugin, etc)
PR checklist
./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\
.master
.