~mcornick/linenoise-cli

password generator in Go using my linenoise module
dd8279f6 — Mark Cornick 22 days ago
Version 1.0.2
bcd5ba74 — Mark Cornick 22 days ago
build: fully-qualify module name
deps(cobra); update cobra to v1.6.1

clone

read-only
https://git.sr.ht/~mcornick/linenoise-cli
read/write
git@git.sr.ht:~mcornick/linenoise-cli

You can also use your local clone with git send-email.

#linenoise-cli

linenoise-cli is a command-line tool that generates strings of random characters that can be used as reasonably secure passwords.

Passwords are, by default, chosen from the union of three character classes: upper-case letters, lower-case letters, and digits.

Options can be given to omit any one or any two of these character classes. For instance, you can omit uppercase letters and digits by passing --upper=false --digit=false to linenoise-cli. This will return a password composed only of lowercase letters.

Passwords are guaranteed to contain at least one of each selected character class. The default length is 16. linenoise-cli will create a password of any length greater than or equal to the number of character classes selected.

If the password length is less than or equal to the total number of characters selected, linenoise-cli will not repeat characters within the generated password.

#Installation

The usual go build works.

Once the binary is built, linenoise-cli completion [shell] will generate completion files for bash, zsh, fish, or powershell.

#Usage

#Command Line

linenoise-cli is a command-line tool that generates strings of
random characters that can be used as reasonably secure passwords.

Usage:
  linenoise-cli [flags]
  linenoise-cli [command]

Available Commands:
  completion  Generate completion script
  help        Help about any command

Flags:
      --digit        include digits (default true)
  -h, --help         help for linenoise-cli
      --length int   length (default 16)
      --lower        include lowercase (default true)
      --upper        include uppercase (default true)

Use "linenoise-cli [command] --help" for more information about a command.

$ linenoise-cli
h6ECtbDZPnRddHV7
$ linenoise-cli --length=8
XdWod8f8
$ linenoise-cli --length=64
QhESpeyPDidxV9kFNCrJqeMa4XUYbET4B3s5oGA8kYsV6XwDKHrCL7wojGZm9gj5
$ linenoise-cli --length=0
2017/10/31 16:04:47 Invalid length - must be an integer greater than 2
$ linenoise-cli --lower=false
387HNFDEUW4YGMZA
$ linenoise-cli --upper=false --length=8
hcsym6tj
$ linenoise-cli --lower=false --upper=false --length=32
92992759356835354563826487673794
$ linenoise-cli --lower=false --upper=false --digit=false
2021/10/02 21:38:36 must include at least one of --lower, --upper and/or --digit
exit status 1

#Configuration File

linenoise-cli supports an optional configuration file. It must be in a format supported by viper, such as YAML, TOML, or JSON; be named config.XXXX with the proper format suffix; be located in $HOME/Library/Application Support/linenoise-cli (macOS) or $XDG_CONFIG_HOME/linenoise-cli (other Unix) or /etc/linenoise-cli; and use the command line options as keys.

For example, this data in config.yaml would replicate the default configuration of linenoise-cli:

---
length: 16
upper: true
lower: true
digit: true

Configuration is also possible using environment variables. For example, these environment variables would replicate the default configuration of linenoise-cli:

export LINENOISE_LENGTH=16
export LINENOISE_UPPER=1
export LINENOISE_LOWER=1
export LINENOISE_DIGIT=1

(To disable uppercase, lowercase, or digits, set the appropriate variable to 0.)

Values given on the command line take precedence over values given in the configuration file or in environment variables.

#Contributing

Bug reports are welcome on Sourcehut at https://todo.sr.ht/~mcornick/linenoise. Patches can be sent to ~mcornick/linenoise@lists.sr.ht.

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

linenoise-cli is available as open source under the terms of the MIT License.