You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
User prompts that use read -rp don't work properly with grc
See the reproduction steps for more information
Reproduction Steps:
Save the following as test.conf
# Everything
regexp=.|\.
colours="\033[38;5;38m"
Save the following as test.sh
#!/bin/bashprompt() {
local input question="Prompt text: Would you like do something now (y/n)?"whiletrue;doread -rp "$question" input
case$inputin
[Yy]* ) echo"yes was chosen";break;;
[Nn]* ) echo"no was choosen";break;;
* ) echo"Please answer y for yes or n for no.";;
esacdonereturn 0
}
echo"The prompt text will only display after the script terminates AND nothing else will be colorized if the -e option is used."echo"The prompt text will not be colorzied BUT everything else will be colorized if the -s option used"echo"The prompt text will only display after the script terminates BUT everything else will be colorized if the -e and -s options used"echo"Everything misbehaves if there is not a delay (0.2 seconds works) added before the read call (user prompt) is made"
sleep .2 && prompt
Run the following commands and observe the behaviour each time:
grc -ec test.conf bash test.sh
grc -sc test.conf bash test.sh
grc -esc test.conf bash test.sh
Prompt text will only be colorized when using the -e or -s option but will only appear after the script terminates which is makes it unusable.
Omitting the -e and or the -s option(s) is a workaround but the prompt text is not colorzied.
Expected behavior
Prompt text should be colorized just like any other piece of text
when the -e option, prompt text should be colorized as expected
when using the -e option. prompt text should appear right away and not after the script terminates
Problem:
User prompts that use
read -rp
don't work properly withgrc
See the reproduction steps for more information
Reproduction Steps:
Save the following as
test.conf
Save the following as
test.sh
Run the following commands and observe the behaviour each time:
grc -ec test.conf bash test.sh
grc -sc test.conf bash test.sh
grc -esc test.conf bash test.sh
Prompt text will only be colorized when using the
-e
or-s
option but will only appear after the script terminates which is makes it unusable.Omitting the
-e
and or the-s
option(s) is a workaround but the prompt text is not colorzied.Expected behavior
-e
option, prompt text should be colorized as expected-e
option. prompt text should appear right away and not after the script terminatesWorkarounds
Can anyone suggest anything?
Additional Information
This seems related to: #82
The text was updated successfully, but these errors were encountered: