feat: CLI autocomplete
Migrated from GitLab: https://gitlab.com/meltano/sdk/-/issues/95
Originally created by @edgarrmondragon on 2021-04-12 06:34:44
As I was trying to add shell autocompletion for a tap built with the SDK, I was able to do so following the click documentation. However, it felt like an unnecessarily complicated process and something the SDK should offer to plugin developers for free. Then I came across Typer, a library for building CLIs, built on top of click and extending it with a friendlier API and other perks. I was able to subclass singer_sdk.tap_base.Tap to use the library without any changes to the already working tap code (except for the super class).
I found some immediate benefits by using Typer.
End user
- Easy to install completion for common shells (Bash, Zsh, Fish, Powershell)
- More descriptive
--helpcommand with typed options, including enums. For example--format [plain|json] [default: plain]
Plugin developer:
- Automatic markdown documentation for your plugin
SDK developer:
- Use type annotations to declare option types
- Less code repetition (e.g. CLI Option decorator for
--catalogand a function argumentcatalog)
At the moment, the particular tap is not public but I plan to do the same to tap-confluence, and I can also start a MR if this is something you think the SDK should have.
Any update on this feature everyone?
@edgarrmondragon I think we've actually done most of these in the SDK at this point, right? Easy to install completion for common shells is likely the only one missing I think (unless I'm misunderstanding that one).
@edgarrmondragon I think we've actually done most of these in the SDK at this point, right?
Easy to install completion for common shellsis likely the only one missing I think (unless I'm misunderstanding that one).
@tayloramurphy Yeah, that's only missing bit. I've updated the title.
@tikikun we've update the title of this issue to focus just on autocomplete as everything else mentioned has been shipped in previous releases 🎉
This has been marked as stale because it is unassigned, and has not had recent activity. It will be closed after 21 days if no further activity occurs. If this should never go stale, please add the evergreen label, or request that it be added.
Still relevant
This has been marked as stale because it is unassigned, and has not had recent activity. It will be closed after 21 days if no further activity occurs. If this should never go stale, please add the evergreen label, or request that it be added.