Formatting
This commit is contained in:
parent
901defa034
commit
3d11eda662
1 changed files with 7 additions and 11 deletions
|
@ -3,23 +3,20 @@
|
||||||
# Functions
|
# Functions
|
||||||
function fold() { /usr/bin/fold --spaces --width="$(tput cols)"; }
|
function fold() { /usr/bin/fold --spaces --width="$(tput cols)"; }
|
||||||
|
|
||||||
function _urlify-1 ()
|
function _urlify-1() {
|
||||||
{
|
|
||||||
local items=($@)
|
local items=($@)
|
||||||
for item in "${items[@]:1}"; do
|
for item in "${items[@]:1}"; do
|
||||||
echo "$1=${item}"
|
echo "$1=${item}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function urlify ()
|
function urlify() {
|
||||||
{
|
|
||||||
local uitems=($(_urlify-1 "$@"))
|
local uitems=($(_urlify-1 "$@"))
|
||||||
local IFS="&"
|
local IFS="&"
|
||||||
echo "${uitems[*]}"
|
echo "${uitems[*]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function make-url ()
|
function make-url() {
|
||||||
{
|
|
||||||
local countryparams
|
local countryparams
|
||||||
local protocolparams
|
local protocolparams
|
||||||
local ipparams
|
local ipparams
|
||||||
|
@ -33,8 +30,7 @@ function make-url ()
|
||||||
echo "${url}/?${countryparams}&${protocolparams}&${ipparams}&${statusparams}"
|
echo "${url}/?${countryparams}&${protocolparams}&${ipparams}&${statusparams}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function load-global-config ()
|
function load-global-config() {
|
||||||
{
|
|
||||||
local IFS=":"
|
local IFS=":"
|
||||||
|
|
||||||
for dir in $1; do
|
for dir in $1; do
|
||||||
|
@ -58,11 +54,11 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check destination
|
# Check destination
|
||||||
if [[ ! -e "$dest" ]] && [[ ! -w "$(dirname "$dest")" ]]; then
|
if [[ ! -e $dest ]] && [[ ! -w "$(dirname "$dest")" ]]; then
|
||||||
echo "Need write permission for $(dirname "$dest") to create \
|
echo "Need write permission for $(dirname "$dest") to create \
|
||||||
${dest}. Perhaps you should use sudo." | fold >&2
|
${dest}. Perhaps you should use sudo." | fold >&2
|
||||||
exit 1
|
exit 1
|
||||||
elif [[ -e "$dest" ]] && [[ ! -w "$dest" ]]; then
|
elif [[ -e $dest ]] && [[ ! -w $dest ]]; then
|
||||||
echo "Need write permission for ${dest}, perhaps you should use \
|
echo "Need write permission for ${dest}, perhaps you should use \
|
||||||
sudo." | fold >&2
|
sudo." | fold >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in a new issue