Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Auto-complete soda CLI commands #296

Closed
mathissedestrooper opened this issue Mar 13, 2021 · 7 comments
Closed

Auto-complete soda CLI commands #296

mathissedestrooper opened this issue Mar 13, 2021 · 7 comments
Labels
enhancement New feature or request soda-sql

Comments

@mathissedestrooper
Copy link

Is your feature request related to a problem? Please describe.
I'm constantly trying to auto-complete soda commands by pressing "tab".

Describe the solution you'd like
Auto-complete soda-commands.

Additional context
This is definitely not a crucial feature request but could be a nice-to-have in the future 😃

Soda SQL Version:
Soda CLI version 2.0.0b21

@mathissedestrooper mathissedestrooper added enhancement New feature or request soda-sql labels Mar 13, 2021
@milanaleksic
Copy link
Contributor

If you are using bash this should work:
eval "$(_SODA_COMPLETE=source_bash soda)"

Can you try it out?

Reference: https://click.palletsprojects.com/en/7.x/bashcomplete/

@mathissedestrooper
Copy link
Author

Hi @milanaleksic

I'm using zsh. I tried adding eval "$(_SODA_COMPLETE=source_zsh soda) to my ~/.zshrc file as described here: https://click.palletsprojects.com/en/7.x/bashcomplete/ but no luck so far. Might that be because I'm running soda-sql in a virtual python environment?

@milanaleksic
Copy link
Contributor

Correct.

Soda is not currently meant to be a globally installed CLI toolkit, but to keep it contained in a virtual environment. You might want to propose to create binary packages later on which we can install independently from the other tools in the target computer by having separate dependencies (maybe even separate python?) and then you can add that line in your shell config.

For now the only thing I can say that your eval command should work while you are in a virtual environment, since the soda command needs to be available to provide the shell completion shell functions.

@tombaeyens tombaeyens changed the title [IDEA] Auto-complete soda commands Auto-complete soda CLI commands Mar 28, 2021
@vijaykiran
Copy link
Contributor

This works as advertised, Using peen and activating the proper venv with soda command.

soda-sql on  main via 🐍 v3.8.5 (soda-sql-main)
❯ eval "$(_SODA_COMPLETE=source_zsh soda)"
soda-sql on  main via 🐍 v3.8.5 (soda-sql-main)
❯ soda <TAB>
analyze  -- Analyzes tables in the warehouse and creates...
create   -- Creates a new warehouse.yml file and prepares...
scan     -- Computes all measurements and runs all tests...

I don't think there is more we can do, because the user can configure it themselves.

@mathissedestrooper
Copy link
Author

Works indeed! Great thx :)

@milanaleksic
Copy link
Contributor

We could document it though for the users so they know it is supported?

@mathissedestrooper
Copy link
Author

@milanaleksic makes sense. Although it's fairly limited now. It only works on the commands and not on the optional parameters I think

@vijaykiran vijaykiran transferred this issue from sodadata/soda-core Mar 22, 2022
@vijaykiran vijaykiran transferred this issue from sodadata/soda-core Mar 22, 2022
@vijaykiran vijaykiran transferred this issue from sodadata/soda-core Mar 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request soda-sql
Projects
None yet
Development

No branches or pull requests

3 participants