Added filename return to the dialogue mockup

This commit is contained in:
fedir 2025-05-06 12:18:21 +02:00
parent 801a7cdb39
commit 15fa0fe193
Signed by: fedir
GPG Key ID: C959EE85F0C9362C

View File

@ -1,29 +1,41 @@
#!/bin/bash #!/bin/bash
# fake-zenity: script that mocks the behavior of zenity based on the ./.fake-zenity-response file # fake-icfs_dialogue: script that mocks the behavior of icfs_dialogue based on the ./.fake-icfs_dialogue-response file
ZENITY_YES=0 ICFS_DIALOGUE_YES=0
ZENITY_NO=1 ICFS_DIALOGUE_NO=1
ZENITY_PERM=2 ICFS_DIALOGUE_PERM=2
if [[ $1 == "--set-fake-response" ]]; then if [[ $1 == "--set-fake-response" ]]; then
#someone knows we are fake :) #someone knows we are fake :)
echo "$2" >~/.fake_zenity_response echo "$2" >~/.fake_icfs_dialogue_response
elif [[ $1 == "--set-fake-response-filename" ]]; then
echo "$2" >~/.fake_icfs_dialogue_response_filename
elif [[ $1 == "--reset-fake-response" ]]; then
rm ~/.fake_icfs_dialogue_response ~/.fake_icfs_dialogue_response_filename
else else
if [ -f ~/.fake_zenity_response ]; then if [ -f ~/.fake_icfs_dialogue_response ]; then
FAKE_ZENITY_RESPONSE=$(cat ~/.fake_zenity_response) FAKE_ICFS_DIALOGUE_RESPONSE=$(cat ~/.fake_icfs_dialogue_response)
if [[ -f ~/.fake_icfs_dialogue_response_filename ]]; then
FAKE_ICFS_DIALOGUE_RESPONSE_FILENAME=$(cat ~/.fake_icfs_dialogue_response_filename)
if [[ $FAKE_ICFS_DIALOGUE_RESPONSE_FILENAME == "" ]]; then
printf "%s" "$4" printf "%s" "$4"
if [[ $FAKE_ZENITY_RESPONSE == "yes" ]]; then else
exit "$ZENITY_YES" printf "%s" "$(cat ~/.fake_icfs_dialogue_response_filename)"
elif [[ $FAKE_ZENITY_RESPONSE == "no" ]]; then fi
exit "$ZENITY_NO" fi
elif [[ $FAKE_ZENITY_RESPONSE == "yes_perm" ]]; then
exit "$((ZENITY_YES | ZENITY_PERM))" if [[ $FAKE_ICFS_DIALOGUE_RESPONSE == "yes" ]]; then
elif [[ $FAKE_ZENITY_RESPONSE == "no_perm" ]]; then exit "$ICFS_DIALOGUE_YES"
exit "$((ZENITY_NO | ZENITY_PERM))" elif [[ $FAKE_ICFS_DIALOGUE_RESPONSE == "no" ]]; then
exit "$ICFS_DIALOGUE_NO"
elif [[ $FAKE_ICFS_DIALOGUE_RESPONSE == "yes_perm" ]]; then
exit "$((ICFS_DIALOGUE_YES | ICFS_DIALOGUE_PERM))"
elif [[ $FAKE_ICFS_DIALOGUE_RESPONSE == "no_perm" ]]; then
exit "$((ICFS_DIALOGUE_NO | ICFS_DIALOGUE_PERM))"
fi fi
fi fi
fi fi
exit 255 # TODO: call actual zenity here exit 255 # TODO: call actual icfs_dialogue here