allow datafile location to be overriden
This commit is contained in:
1 parent
af890aea59
commit
763445330e
3 files changed
+20
-15
No files matched your search
@@ -39,14 +39,15 @@ EXAMPLES
|
||||
NOTES
|
||||
Installation:
|
||||
|
||||
optionally:
|
||||
set $_Z_CMD in .bashrc/.zshrc to change the command (default z).
|
||||
Optionally:
|
||||
Set $_Z_CMD in .bashrc/.zshrc to change the command (default z).
|
||||
Set $_Z_DATA to change the datafile (default $HOME/.z).
|
||||
|
||||
put something like this in your $HOME/.bashrc:
|
||||
Put something like this in your $HOME/.bashrc:
|
||||
|
||||
. /path/to/z.sh
|
||||
|
||||
put something like this in your $HOME/.zshrc:
|
||||
Put something like this in your $HOME/.zshrc:
|
||||
|
||||
. /path/to/z.sh
|
||||
function precmd () {
|
||||
@@ -57,8 +58,8 @@ NOTES
|
||||
|
||||
PROFIT!!
|
||||
|
||||
optionally:
|
||||
install the provided man page z.1 somewhere like /usr/local/man/man1.
|
||||
Optionally:
|
||||
Install the provided man page z.1 somewhere like /usr/local/man/man1.
|
||||
|
||||
Aging:
|
||||
|
||||
@@ -105,7 +106,7 @@ ENVIRONMENT
|
||||
|
||||
|
||||
FILES
|
||||
data is stored in $HOME/.z
|
||||
Data is stored in $_Z_DATA. If not set, $_Z_DATA defaults to $HOME/.z
|
||||
|
||||
A man page (z.1) is provided.
|
||||
|
||||
|
||||
@@ -39,14 +39,16 @@ directory that matches ALL of the regexes given on the command line.
|
||||
|
||||
\fBInstallation:\fR
|
||||
.P
|
||||
optionally:
|
||||
set \fB$_Z_CMD\fR in .bashrc/.zshrc to change the command (default \fBz\fR).
|
||||
Optionally:
|
||||
Set \fB$_Z_CMD\fR in .bashrc/.zshrc to change the command (default \fBz\fR).
|
||||
.br
|
||||
Set \fB$_Z_DATA\fR to change the datafile (default \fB$HOME/.z\fR).
|
||||
.P
|
||||
put something like this in your \fB$HOME/.bashrc\fR:
|
||||
Put something like this in your \fB$HOME/.bashrc\fR:
|
||||
.P
|
||||
\fB. /path/to/z.sh\fR
|
||||
.P
|
||||
put something like this in your \fB$HOME/.zshrc\fR:
|
||||
Put something like this in your \fB$HOME/.zshrc\fR:
|
||||
.P
|
||||
\fB. /path/to/z.sh
|
||||
function precmd () {
|
||||
@@ -57,8 +59,8 @@ put something like this in your \fB$HOME/.zshrc\fR:
|
||||
.P
|
||||
PROFIT!!
|
||||
.P
|
||||
optionally:
|
||||
install the provided man page \fBz.1\fR somewhere like \fB/usr/local/man/man1\fB.
|
||||
Optionally:
|
||||
Install the provided man page \fBz.1\fR somewhere like \fB/usr/local/man/man1\fB.
|
||||
.br
|
||||
|
||||
\fBAging:\fR
|
||||
@@ -109,7 +111,8 @@ An alias \fB$_Z_CMD\fR='_z 2>&1' is defined. If not set, \fB$_Z_CMD\fR defaults
|
||||
to \fBz\fR.
|
||||
|
||||
.SH FILES
|
||||
data is stored in \fB$HOME/.z\fR
|
||||
Data is stored in \fB$_Z_DATA\fR. If not set, \fB$_Z_DATA\fR defaults to
|
||||
\fB$HOME/.z\fR
|
||||
.P
|
||||
A man page (\fBz.1\fR) is provided.
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
# INSTALL:
|
||||
# * optionally:
|
||||
# set $_Z_CMD in .bashrc/.zshrc to change the command (default z).
|
||||
# set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z).
|
||||
# * put something like this in your .bashrc:
|
||||
# . /path/to/z.sh
|
||||
# * put something like this in your .zshrc:
|
||||
@@ -24,7 +25,7 @@
|
||||
|
||||
_z() {
|
||||
|
||||
local datafile="$HOME/.z"
|
||||
local datafile="${_Z_DATA:-$HOME/.z}"
|
||||
|
||||
# bail out if we don't own ~/.z (we're another user but our ENV is still set)
|
||||
[ -f "$datafile" -a ! -O "$datafile" ] && return
|
||||
|
||||
Reference in new issue
Block a user