Skip to content

Commit

Permalink
Merge pull request #25 from namelessjon/master
Browse files Browse the repository at this point in the history
Use XDG directories when defined
  • Loading branch information
micha committed Jul 16, 2011
2 parents d9f001e + 7a693be commit a7001b2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions resty
Expand Up @@ -14,13 +14,20 @@ export _resty_path=""
export _resty_nohistory=""

function resty() {
local confdir host cookies method h2t editor domain _path opt dat res ret out err verbose raw i j d tmpf args2 wantdata vimedit quote query maybe_query
local confdir datadir host cookies method h2t editor domain _path opt dat res ret out err verbose raw i j d tmpf args2 wantdata vimedit quote query maybe_query
local -a curlopt
local -a curlopt2

confdir="${HOME}/.resty"
host="${confdir}/host"
cookies="$confdir/c"
if [ -n "$XDG_CONFIG_HOME" ]; then
confdir="$XDG_CONFIG_HOME/resty"
datadir="$XDG_DATA_HOME/resty"
else
confdir="$HOME/.resty"
datadir="$confdir"
fi
mkdir -p "$confdir"
host="$datadir/host"
cookies="$datadir/c"
method="$1"; [[ $# > 0 ]] && shift
h2t=$((exec 2>&-; (which lynx >/dev/null && echo lynx -stdin -dump) \
|| which html2text || which cat) |tail -n 1)
Expand Down

0 comments on commit a7001b2

Please sign in to comment.