Skip to content

amritsingh183/credentialcli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About the password utility

main-branch dev-branch release-branch GitHub release (latest SemVer)

This CLI utility is built for generating password(s). It was made with love using https://github.com/spf13/cobra-cli

How to install

There are two ways to install the password utility

Method 1: Download a pre-built binary

You can download the pre-built exectable binary for your operating system from the releases page https://github.com/amritsingh183/credentialcli/releases and add the binary to your programs path /usr/local/bin.

wget https://github.com/amritsingh183/credentialcli/releases/download/v0.0.2/password-0.0.2-linux-amd64

mv password-0.0.2-linux-amd64 /usr/local/bin/password
password -v # should show you the current version

Now, you can generate a password using following command

password generate

this will generate password with default options. All options, inluding the default ones are defined in the section Default options

Method 2: Building from source

Assuming you have go installed on your system, clone this repository and then run

make install

this will create a binary file named password in your $GOBIN. You may add $GOBIN to your $PATH to run the password utility

Another option is to build binaries for distribution by running

make binary

This will create binaries for Darwin-amd64, Linux-amd64, Linux-arm64 in ./out/bin. Rest of the steps are same as Method 1

Available options for controlling the generated password

The default options are:

  • length=7
  • output=terminal
  • includeSpecialCharacters=true
  • count=1

The purpose of each option is as follows:

  • Length of the password(s) can be specified using length=8 forexample
  • To dump the password(s) to console set output=0
  • To dump the password(s) to file set output=1 and set filepath using file=/your/filepath
  • To control the number of passwords use count=20 for example
  • If you want to include special characters in your passwords(recommended) use the includeSpecialCharacters true flag

How to use this utility

If you have followed the Installation instructions, you can use the following examples. You can check All available options.

  • To generate a password with default options

    password generate
  • To generate a password with specified length and output to default file ./passwords.txt

    password generate --length=40 --output=1 
  • To generate 10 passwords with specified length and output to specific file ./myPassword.txt

    password generate --length=40 --output=1 --count=10 --file=./myPassword.txt
  • To generate 10 passwords with specified length and output to console

    password generate --length=40 --count=10

How to run tests for the source code

To run the tests from the code, simply run the below command. Make sure to remove the default password file passwords.txt , if it already exists. For safety, the code will not remove an exising file, matching the default password-file name

make test

How to test it without installing

Simply replace ~/go/bin/password with go run main.go and you can try everything described above.

New Requirements

The next you're asked is to create a hierarchy of commands in this way:

  • password is the master command
    • generate is the actual command to generate the password
    • validate checks the password against a predefined set of rules and shares those with the user.

Everything else that has not been defined is up to you.

About

CLI tool to generate credentials

Resources

Stars

Watchers

Forks

Packages

No packages published