Add no prompt exit option to repl#2758
Conversation
| if self._next_input == default_text: | ||
| self._next_input = None | ||
|
|
||
| def yn_prompt(self, msg: str) -> str: |
There was a problem hiding this comment.
This was only being called from the ask_yn function and can just be moved there?
sfc-gh-jwilkowski
left a comment
There was a problem hiding this comment.
Thanks for your contribution! I like the idea, but I think it would be more useful you could set that as in config.toml or as env variable. You can find a similar implementation in _decimal_precision_callback. To make it clear that it's scoped only to repl, maybe it will be better to be explicit about it in the name, so something like no_prompt_exit_repl?
Please also add some unit tests for this change, here you'll find some examples
| single_transaction = bool(single_transaction) | ||
| std_in = bool(std_in) | ||
|
|
||
| if no_prompt_exit_repl is None: |
There was a problem hiding this comment.
This follows the same order of precedence documented in https://docs.snowflake.com/en/developer-guide/snowflake-cli/connecting/configure-connections:
- Command-line parameters
- Environment variables overriding specific config.toml parameters, such as SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD
- Connections defined in config.toml file manually or using snow connection add command
Thank you for taking a look at this. I renamed the option and added a the and environment variable and config check. |
Pre-review checklist
Changes description
This is adding a --no-prompt-exit option to the snow sql command to exit without getting prompted; tested locally.