dbt-labs / dbt-completion.bash Goto Github PK
View Code? Open in Web Editor NEWAdds autocompletion to the dbt CLI
Home Page: https://www.getdbt.com/
License: Apache License 2.0
Adds autocompletion to the dbt CLI
Home Page: https://www.getdbt.com/
License: Apache License 2.0
Hi!
I just came across the bash completion script, and while I am using zsh myself, the current script worked to auto-complete the models, with 2 caveats:
So, after spending a bit of time understanding zsh completion mechanism I have created the following script:
Gist link
--
Installation
Pros:
invoice
will match models customer_invoice
and vendor_invoice
dbt run
, dbt test
and dbt docs
as well as the global flags)Cons:
dbt run
or dbt test
the models will be suggested even though there is no model selection flag defined or if the model selection flag is not the last one in the list--
Happy to submit a PR and share the script on this repo if people want to use it and improve it.
zinit ice as"completion"
zinit snippet https://github.com/dbt-labs/dbt-completion.bash/blob/master/_dbt
I have a bunch of models with prefixes stg_
or int_
I would like to be able to tab complete the prefix from just the name after the prefix.
i.e.
If I have 3 models: stg_model_a_v1
, stg_model_a_v2
and stg_model_a_v3
I would like this to happen:
$ dbt run -s model_a<TAB>
to become:
$ dbt run -s stg_model_a_v
stg_model_a_v1 stg_model_a_v2 stg_model_a_v3
I know this is possible since this is the default functionality for autocompletion for e.g. ls
I am very new to zsh so contributing myself seems like a long shot.
Hi,
dbt completion doesn't seem to work with the new Warp terminal. This might have to do with the fact that Warp doesn't use <tab>
for auto-completion but the right arrow key instead.
dbt completion works with iTerm on Mac. (It's sourced as part of my ~/.bash_profile
and so on.) However, nothing happens when I'm trying to use <tab>
or the right arrow key to auto-complete a dbt node name.
Curious if this is a known issue or if I didn't configure this correctly.
When I type dbt run
antigen suggests arguments and values to populate, but tab does not list all of the options.
After installing this completion script, I realized that it doesn't complete subcommands, e.g. I expect dbt d<TAB>
to offer debug deps docs
, or, dbt run --s<TAB>
to offer --select --selector --state
as completions.
Digging around, I learned that the dbt CLI is built using Click and that it supports shell completion.
It would be nice to merge that generated script with this one to get the best of both worlds!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.