Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use XDG directories when defined #25

Merged
merged 2 commits into from

2 participants

@namelessjon

These patches make resty default to using the XDG basedir spec by default. Host files (e,g. localhost:5984) are stored in $XDG_CONFIG_HOME/resty whilst cookies and the host file are stored in $XDG_DATA_HOME/resty. If XDG_CONFIG_HOME is undefined, the previous default of $HOME/.resty is used.

namelessjon added some commits
@namelessjon namelessjon Use XDG Base Directory instead of a .directory
Host files are read from $XDG_CONFIG_HOME/resty. Cookies and host file
are stored in $XDG_DATA_HOME/resty/c and $XDG_DATA_HOME/resty/host,
respectively.  One less .directory in $HOME.
39ac1c9
@namelessjon namelessjon Fallback to ~/.resty without XDG dirs
Be a bit kinder to people without XDG goodness
7a693be
@micha micha merged commit a7001b2 into micha:master
@micha
Owner

Awesome, thanks! I had a little bit of a dilemma thinking about people who have an XDB environment but already are using a .resty config dir, but I think an update to the README should be sufficient. I think people can manually copy the directories if they really want to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 13, 2011
  1. @namelessjon

    Use XDG Base Directory instead of a .directory

    namelessjon authored
    Host files are read from $XDG_CONFIG_HOME/resty. Cookies and host file
    are stored in $XDG_DATA_HOME/resty/c and $XDG_DATA_HOME/resty/host,
    respectively.  One less .directory in $HOME.
Commits on Jul 15, 2011
  1. @namelessjon

    Fallback to ~/.resty without XDG dirs

    namelessjon authored
    Be a bit kinder to people without XDG goodness
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 4 deletions.
  1. +11 −4 resty
View
15 resty
@@ -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)
Something went wrong with that request. Please try again.