diff options
author | Rasmus Steinke <rasi@xssn.at> | 2018-08-02 21:15:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-02 21:15:55 +0200 |
commit | 4c23faa1fbfeac0993e733fccd34ed7277c39f3d (patch) | |
tree | 82d4a31551da6b1d5a0851f39fc9a8696158488e | |
parent | 4fdd367c6b69f2e5b740ba86ce304f58d18ec03e (diff) | |
parent | db4383a186663e5091a373d46c8096c8fdc8c5af (diff) | |
download | rofi-pass-4c23faa1fbfeac0993e733fccd34ed7277c39f3d.tar.gz |
Merge pull request #140 from takuyozora/pr/filename_as_user
Allow to use the password filename as user
-rw-r--r-- | README.md | 6 | ||||
-rwxr-xr-x | rofi-pass | 6 |
2 files changed, 11 insertions, 1 deletions
@@ -121,6 +121,12 @@ Rofi-pass allows you to easily share common used passwords across multiple entri For example, if you have an academic account which includes several services (such as a library, Salary, Student portal etc), all with different URL's, login forms etc. you can share one password across all of them. This is very handy when the passwords change annually. To use this function you need to add the following line instead of the password, referencing a pass file which holds the password. +## User filename as user + +If your password file has no user field you can ask rofi-pass to use the filename instead. +For example with this password file path : `web/fsf.org/rms` rofi-pass will user `rms` as your username. +To get this, you need to set `default_user` to `:filename` in your configuration. + ``` #FILE=PATH/to/filename ``` @@ -417,7 +417,11 @@ mainMenu () { fi if [[ -z "${stuff["${USERNAME_field}"]}" ]]; then if [[ -n $default_user ]]; then - stuff["${USERNAME_field}"]="${default_user}" + if [[ "$default_user" == ":filename" ]]; then + stuff["${USERNAME_field}"]="$(basename $selected_password)" + else + stuff["${USERNAME_field}"]="${default_user}" + fi fi fi pass_content="$(for key in "${!stuff[@]}"; do printf '%s\n' "${key}: ${stuff[$key]}"; done)" |