mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-20 07:05:05 -04:00
pairdrop-cli: Exit application if config file cannot be created on first run
This commit is contained in:
parent
ff883fb994
commit
89addd6649
2 changed files with 11 additions and 5 deletions
|
@ -24,7 +24,7 @@ This opens PairDrop in the default browser where you can choose the receiver.
|
||||||
```bash
|
```bash
|
||||||
pairdrop -h
|
pairdrop -h
|
||||||
```
|
```
|
||||||
```bash
|
```
|
||||||
Send files or text with PairDrop via command-line interface.
|
Send files or text with PairDrop via command-line interface.
|
||||||
Current domain: https://pairdrop-dev.onrender.com/
|
Current domain: https://pairdrop-dev.onrender.com/
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ Send text: pairdrop -t "text"
|
||||||
Specify domain: pairdrop -d "https://pairdrop.net/"
|
Specify domain: pairdrop -d "https://pairdrop.net/"
|
||||||
Show this help text: pairdrop (-h|--help)
|
Show this help text: pairdrop (-h|--help)
|
||||||
|
|
||||||
This pairdrop-cli version was released alongside v1.10.0
|
This pairdrop-cli version was released alongside v1.10.4
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# PairDrop version when this file was last changed
|
||||||
|
version="v1.10.4"
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# Help #
|
# Help #
|
||||||
############################################################
|
############################################################
|
||||||
|
@ -17,7 +20,7 @@ help()
|
||||||
echo -e "Specify domain:\t\t$(basename "$0") -d \"https://pairdrop.net/\""
|
echo -e "Specify domain:\t\t$(basename "$0") -d \"https://pairdrop.net/\""
|
||||||
echo -e "Show this help text:\t$(basename "$0") (-h|--help)"
|
echo -e "Show this help text:\t$(basename "$0") (-h|--help)"
|
||||||
echo
|
echo
|
||||||
echo "This pairdrop-cli version was released alongside v1.10.0"
|
echo "This pairdrop-cli version was released alongside ${version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
openPairDrop()
|
openPairDrop()
|
||||||
|
@ -337,12 +340,15 @@ popd > '/dev/null';
|
||||||
|
|
||||||
config_path="${script_path}/.pairdrop-cli-config"
|
config_path="${script_path}/.pairdrop-cli-config"
|
||||||
|
|
||||||
|
# If config file does not exist, try to create it. If it fails log error message and exit
|
||||||
[ ! -f "$config_path" ] &&
|
[ ! -f "$config_path" ] &&
|
||||||
specifyDomain "https://pairdrop.net/" &&
|
specifyDomain "https://pairdrop.net/" &&
|
||||||
[ ! -f "$config_path" ] &&
|
[ ! -f "$config_path" ] &&
|
||||||
echo "Could not create config file. Add 'DOMAIN=https://pairdrop.net/' to a file called .pairdrop-cli-config in the same file as this 'pairdrop' bash file"
|
echo "Could not create config file. Add 'DOMAIN=https://pairdrop.net/' to a file called .pairdrop-cli-config in the same file as this 'pairdrop' bash file (${script_path})" &&
|
||||||
|
exit
|
||||||
|
|
||||||
[ ! -f "$config_path" ] || export "$(grep -v '^#' "$config_path" | xargs)"
|
# Read config variables
|
||||||
|
export "$(grep -v '^#' "$config_path" | xargs)"
|
||||||
|
|
||||||
setOs
|
setOs
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue