Skip to content

Commit

Permalink
add 'tty' usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jschauma committed May 29, 2022
1 parent eb18583 commit ff258eb
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# getpass - a Go module to get a password

The `getpass` module provides a simple way to retrieve
a password from the user by specifying a number of
different password sources:
The `getpass` module provides a simple way to retrieve a password from
the user by specifying a number of different password sources:

```
func Getpass(passfrom, prompt string) (pass string, err error)
```

Getpass retrieves a password from the user using a
method defined by the `passfrom` string. The
following methods are supported:
Getpass retrieves a password from the user using a method defined by
the `passfrom` string. The following methods are supported:

`env:var` -- Obtain the password from the environment variable var.
Since the environment of other processes may be visible
Expand All @@ -26,23 +24,22 @@ controls should be used to protect this file.
password from the macOS keychain.

`lpass:name` -- Use the LastPass command-line client lpass(1) to
retrieve the named password. You should previously have
run 'lpass login' for this to work.
retrieve the named password. You should previously have run 'lpass
login' for this to work.

`op:name` -- Use the 1Password command-line client op(1) to
retrieve the named password.
`op:name` -- Use the 1Password command-line client op(1) to retrieve
the named password.

`pass:password` -- The actual password is password. Since the password is
visible to utilities such as ps(1) and possibly leaked
into the shell history file, this form should only be
used where security is not important.
`pass:password` -- The actual password is password. Since the
password is visible to utilities such as ps(1) and possibly leaked
into the shell history file, this form should only be used where
security is not important.

If no password retrieval method is specified, then
`Getpass` will prompt the user on the controlling tty
using the provided `prompt`.
`tty` -- This is the default if no `passfrom` method is specified:
`Getpass` `Getpass` will prompt the user on the controlling tty using
the provided `prompt`.

If no `prompt` is provided, then `Getpass` will use
"Password: ".
If no `prompt` is provided, then `Getpass` will use "Password: ".

## Examples

Expand Down

0 comments on commit ff258eb

Please sign in to comment.