docs: update
This commit is contained in:
parent
00a4f53744
commit
a22d38a6dd
32
README.md
32
README.md
|
@ -23,6 +23,8 @@ pash
|
|||
* [How does this differ from `pass` or etc?](#how-does-this-differ-from-pass-or-etc)
|
||||
* [Where are passwords stored?](#where-are-passwords-stored)
|
||||
* [How can I use a public key?](#how-can-i-use-a-public-key)
|
||||
* [How do I set the password length?](#how-do-i-set-the-password-length)
|
||||
* [How do I change the password store location?](#how-do-i-change-the-password-store-location)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
|
@ -74,8 +76,38 @@ Set the environment variable `PASH_KEYID` to the ID of the key you'd like to enc
|
|||
Example:
|
||||
|
||||
```sh
|
||||
# Default: 'unset'.
|
||||
export PASH_KEYID=XXXXXXXX
|
||||
|
||||
# This can also be an email.
|
||||
export PASH_KEYID=dylan.araps@gmail.com
|
||||
|
||||
# This can also be used as a one-off.
|
||||
PASH_KEYID=XXXXXXXX pash add github
|
||||
```
|
||||
|
||||
### How do I set the password length?
|
||||
|
||||
Set the environment variable `PASH_LENGTH` to a valid integer.
|
||||
|
||||
Example:
|
||||
|
||||
```sh
|
||||
# Default: '50'.
|
||||
export PASH_LENGTH=50
|
||||
|
||||
# This can also be used as a one-off.
|
||||
PASH_LENGTH=10 pash add github
|
||||
```
|
||||
|
||||
### How do I change the password store location?
|
||||
|
||||
Set the environment variable `PASH_DIR` to a directory.
|
||||
|
||||
```sh
|
||||
# Default: '~/.local/share/pash'.
|
||||
export PASH_DIR=~/.local/share/pash
|
||||
|
||||
# This can also be used as a one-off.
|
||||
PASH_DIR=/mnt/drive/pash pash list
|
||||
```
|
||||
|
|
12
pash
12
pash
|
@ -7,8 +7,8 @@ pw_add() {
|
|||
|
||||
case $REPLY in
|
||||
[yY])
|
||||
pass=$("${gpg[0]}" --armor --gen-random 0 50)
|
||||
pass=${pass:0:50}
|
||||
pass=$("${gpg[0]}" --armor --gen-random 0 "${PASH_LENGTH:-50}")
|
||||
pass=${pass:0:${PASH_LENGTH:-50}}
|
||||
;;
|
||||
|
||||
*) read -rsp "Enter password: " pass ;;
|
||||
|
@ -87,6 +87,8 @@ pash 1.0.0 - simple password manager.
|
|||
=> [s]how [name] - Show password for an entry.
|
||||
|
||||
Using a key pair: export PASH_KEYID=XXXXXXXX
|
||||
Password length: export PASH_LENGTH=50
|
||||
Store location: export PASH_DIR=~/.local/share/pash
|
||||
"
|
||||
exit 1
|
||||
}
|
||||
|
@ -98,10 +100,10 @@ main() {
|
|||
mapfile -t gpg < <(type -p gpg gpg2) && [[ ! -x ${gpg[0]} ]] &&
|
||||
die "GPG not found."
|
||||
|
||||
mkdir -p "${pass_dir:=${XDG_DATA_HOME:=$HOME/.local/share}/pash}" ||
|
||||
mkdir -p "${PASH_DIR:=${XDG_DATA_HOME:=$HOME/.local/share}/pash}" ||
|
||||
die "Couldn't create password directory."
|
||||
|
||||
cd "$pass_dir" ||
|
||||
cd "$PASH_DIR" ||
|
||||
die "Can't access password directory."
|
||||
|
||||
[[ $1 == [acds]* && -z $2 ]] &&
|
||||
|
@ -120,7 +122,7 @@ main() {
|
|||
die "Category can't start with '/'."
|
||||
|
||||
[[ $2 == */* ]] &&
|
||||
{ mkdir -p "${2%/*}" || die "Couldn't create category '${2%/*}'.";}
|
||||
{ mkdir -p "${2%/*}" || die "Couldn't create category '${2%/*}'."; }
|
||||
|
||||
umask 077
|
||||
|
||||
|
|
Loading…
Reference in New Issue