sdk icon indicating copy to clipboard operation
sdk copied to clipboard

feat: CLI autocomplete

Open MeltyBot opened this issue 4 years ago • 8 comments

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 --help command 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 --catalog and a function argument catalog)

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.

MeltyBot avatar Apr 12 '21 06:04 MeltyBot

Any update on this feature everyone?

tikikun avatar Feb 20 '23 12:02 tikikun

@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).

tayloramurphy avatar Feb 20 '23 20:02 tayloramurphy

@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).

@tayloramurphy Yeah, that's only missing bit. I've updated the title.

edgarrmondragon avatar Feb 21 '23 17:02 edgarrmondragon

@tikikun we've update the title of this issue to focus just on autocomplete as everything else mentioned has been shipped in previous releases 🎉

tayloramurphy avatar Feb 21 '23 20:02 tayloramurphy

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.

stale[bot] avatar Jul 18 '23 03:07 stale[bot]

Still relevant

tayloramurphy avatar Jul 18 '23 19:07 tayloramurphy

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.

stale[bot] avatar Jul 18 '24 03:07 stale[bot]