CLI improvements (autocomplete, typed options)
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 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.