Commands should support --non-interactive or --yes option
Is your feature request related to a problem? Please describe.
I want to run e.g. supabase db reset inside CI. It asks for confirmation, making it unusable. Also discussed here.
Describe the solution you'd like
I want a switch such as other tools have, i.e. apt-get --assume-yes or pacman -Syu --no-confirm so the CLI command doesn't ask me anything and do its job. For example, I want supabase db reset --linked --assume-yes
Describe alternatives you've considered
$ yes | supabase db reset --linked
but that recently started to fail with:
yes: standard output: Broken pipe
so we have this esoteric approach instead:
- name: Create and run expect script
run: |
sudo apt-get install -y expect
echo '#!/usr/bin/expect -f' > reset_db.exp
echo 'spawn supabase db reset --linked' >> reset_db.exp
echo 'expect {*Do you want to reset the remote database*} { send "y\r" }' >> reset_db.exp
echo 'expect eof' >> reset_db.exp
chmod +x reset_db.exp
./reset_db.exp
That seems to be a limitation with yes https://stackoverflow.com/questions/20573282/hudson-yes-standard-output-broken-pipe I will look into adding the non-interactive flag.
Meanwhile, another alternative is to use here-string
supabase db reset --linked <<< 'y'
Thank you, that works ❤️
Adding a flag to run the all the CLI commands (not just db reset) in a non-interactive environment (e.g. Github actions) is a necessity. If you don't want to put a flag everywhere, then make it look at an environment variable like CI=1 and bypass the interaction in the prompt function.
@rauljmz what specific problem are you facing? The prompts are already skipped using default answers on CI environments like GitHub action.
This specific issue is about answering yes (non-default option) to db reset.
That seems to be a limitation with
yeshttps://stackoverflow.com/questions/20573282/hudson-yes-standard-output-broken-pipe I will look into adding the non-interactive flag.Meanwhile, another alternative is to use
here-stringsupabase db reset --linked <<< 'y'
The Here string solution was not working under node scripts so tinkering a bit I found that using the following it works
echo 'Y' | supabase db reset --linked
it only works with "sh -c echo Y | supabase db reset --linked"