Added filename return to the dialogue mockup
This commit is contained in:
parent
801a7cdb39
commit
15fa0fe193
@ -1,29 +1,41 @@
|
||||
#!/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
|
||||
ZENITY_NO=1
|
||||
ZENITY_PERM=2
|
||||
ICFS_DIALOGUE_YES=0
|
||||
ICFS_DIALOGUE_NO=1
|
||||
ICFS_DIALOGUE_PERM=2
|
||||
|
||||
if [[ $1 == "--set-fake-response" ]]; then
|
||||
#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
|
||||
if [ -f ~/.fake_zenity_response ]; then
|
||||
FAKE_ZENITY_RESPONSE=$(cat ~/.fake_zenity_response)
|
||||
if [ -f ~/.fake_icfs_dialogue_response ]; then
|
||||
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"
|
||||
if [[ $FAKE_ZENITY_RESPONSE == "yes" ]]; then
|
||||
exit "$ZENITY_YES"
|
||||
elif [[ $FAKE_ZENITY_RESPONSE == "no" ]]; then
|
||||
exit "$ZENITY_NO"
|
||||
elif [[ $FAKE_ZENITY_RESPONSE == "yes_perm" ]]; then
|
||||
exit "$((ZENITY_YES | ZENITY_PERM))"
|
||||
elif [[ $FAKE_ZENITY_RESPONSE == "no_perm" ]]; then
|
||||
exit "$((ZENITY_NO | ZENITY_PERM))"
|
||||
else
|
||||
printf "%s" "$(cat ~/.fake_icfs_dialogue_response_filename)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $FAKE_ICFS_DIALOGUE_RESPONSE == "yes" ]]; then
|
||||
exit "$ICFS_DIALOGUE_YES"
|
||||
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
|
||||
|
||||
exit 255 # TODO: call actual zenity here
|
||||
exit 255 # TODO: call actual icfs_dialogue here
|
||||
|
Loading…
x
Reference in New Issue
Block a user