Introduction to Cred CLI

Cred is a simple and secure CLI tool for managing passwords (pass) and environment variables (env) using Go. It encrypts sensitive information using GPG keys, ensuring safe storage and retrieval.

🔹 Features

  • Password Management (cred pass): Store, retrieve, and manage passwords securely.
  • Environment Variable Management (cred env): Store encrypted .env files and retrieve values on demand.
  • GPG Encryption: Uses GNU Privacy Guard (GPG) to encrypt credentials.
  • Simple CLI Interface: Easy-to-use commands for adding, viewing, and modifying stored credentials.
  • Cross-Platform Support: Works on Linux, macOS, and Windows.

📌 Example Usage

🔑 Initialize with a GPG key

cred init <gpg-key-id>

Installation

You can install the tool with the following command:

go install github.com/silentFellow/cred-store@latest

For Windows

Please note that the entire code uses GPG for encryption and decryption. Windows users need to have a GPG client installed, such as Gpg4win.

Completions

For more information on completions, please refer to the completions.md file.

cred quick-setup

Creates a GPG ID and initiates store usage credentials

Synopsis

A longer description that spans multiple lines and likely contains examples and usage of using your command. For example:

Usage: cred quick-setup
cred quick-setup [flags]

Options

  -h, --help   help for quick-setup

SEE ALSO

  • cred - A password and environment variables manager

cred quick-setup

Creates a GPG ID and initiates store usage credentials

Synopsis

A longer description that spans multiple lines and likely contains examples and usage of using your command. For example:

Usage: cred quick-setup
cred quick-setup [flags]

Options

  -h, --help   help for quick-setup

SEE ALSO

  • cred - A password and environment variables manager

cred init

Initialize the credential store

Synopsis

Initialize the credential store with the necessary settings. This command sets up the environment required for storing and managing credentials securely. Note that you must provide a GPG key as an argument.

cred init <gpg-key> [flags]

Options

  -h, --help   help for init

SEE ALSO

  • cred - A password and environment variables manager

cred migrate

Migrate the credential store to a new GPG key

Synopsis

The migrate command allows you to re-encrypt your credential store with a new GPG key. This operation will create a backup of your current store and re-encrypt all files with the new key.

Example Usage: cred migrate <new-gpg-key-id>
cred migrate [flags]

Options

  -h, --help   help for migrate

SEE ALSO

  • cred - A password and environment variables manager

Example Configuration File for Your Go CLI

Location: cred-store/config

Syntax: key = value

Note:

  1. Each configuration entry must be on a new line.
  2. Each line is split into key and value by "=".
  3. Whitespace around keys and values is allowed and will be trimmed automatically.
  4. Duplicate keys are allowed; the last occurrence will overwrite previous values.
  5. Lines starting with # are treated as comments and ignored by the parser.
  6. Invalid config will be ignored by the parser.

Example Configuration:

# Automatically push all changes to Git (true/false)
auto_git = false

# Suppress stderr output (true/false)
suppress_stderr = false

# Editor to use for inserting and editing files
# Provide the full path or name of the editor (e.g., vim, nano, code).
editor = vim

cred

A password and environment variables manager

Synopsis

Cred is a powerful CLI tool built in Go for managing passwords and environment variables. It uses GPG encryption to securely store and manage sensitive information.

Examples and usage:

  • Initialize with a GPG key: cred init
  • Store a new credentials: cred {pass/env} insert
  • Retrieve a credentials: cred {pass/env} show
  • Retrieve a credentials: cred {pass/env} copy
  • List all stored credentials: cred {pass/env} list

Options

      --generate-docs   Creates markdown documentation for the CLI
  -h, --help            help for cred

SEE ALSO

  • cred completion - Generate the autocompletion script for the specified shell
  • cred env - A command to manage env-variables
  • cred git - Manage cred-store git repository and operations
  • cred init - Initialize the credential store
  • cred migrate - Migrate the credential store to a new GPG key
  • cred pass - A command to manage passwords
  • cred quick-setup - Creates a GPG ID and initiates store usage credentials
  • cred ssh - Manage SSH keys and connections

cred env

A command to manage env-variables

Synopsis

The env command allows you to manage your env-variables efficiently. It provides functionalities to create, update, and delete env-variables.

Examples:

  • Create a new env: env {insert/generate}
  • Update an existing env: env edit
  • Delete a env: env rm
cred env [flags]

Options

  -h, --help   help for env

SEE ALSO

cred env insert

Insert a new env entry

Synopsis

The insert command allows you to add a new env entry to the env store. You will be prompted to enter and confirm the env, which will be stored securely. If the entry already exists, you will be asked whether you want to overwrite it.

Examples: cred env insert

cred env insert [flags]

Options

  -h, --help   help for insert

SEE ALSO

  • cred env - A command to manage env-variables

cred env edit

Edit a env entry

Synopsis

Edit a env entry in the env store.

This command allows you to edit an existing env entry in your env store. Usage: cred env edit

cred env edit [flags]

Options

  -h, --help   help for edit

SEE ALSO

  • cred env - A command to manage env-variables

cred env ls

List files and directories

Synopsis

The ls command allows you to list files and directories. It uses the 'ls' command to display the contents of the current directory.

Examples: cred env ls

cred env ls [flags]

Options

  -h, --help   help for ls

SEE ALSO

  • cred env - A command to manage env-variables

cred env mv

Move files and directories

Synopsis

The mv command allows you to move files and directories. It uses the 'mv' command to move the specified file or directory to a new location.

Examples: cred env mv

cred env mv [flags]

Options

  -h, --help   help for mv

SEE ALSO

  • cred env - A command to manage env-variables

cred env cp

copies files and directories

Synopsis

The cp command allows you to copies files and directories. It uses the 'cp' command to move the specified file or directory to a new location.

Examples: cred env cp

cred env cp [flags]

Options

  -h, --help   help for cp

SEE ALSO

  • cred env - A command to manage env-variables

cred env mkdir

Create directories

Synopsis

The mkdir command allows you to create directories, including nested directories. It uses the 'mkdir' command to create the specified path.

Examples: cred env mkdir

cred env mkdir [flags]

Options

  -h, --help   help for mkdir

SEE ALSO

  • cred env - A command to manage env-variables

cred env rm

Remove files and directories

Synopsis

The rm command allows you to remove files and directories recursively. It uses the 'rm' command to delete the specified path.

Examples: cred env rm

cred env rm [flags]

Options

  -h, --help   help for rm

SEE ALSO

  • cred env - A command to manage env-variables

cred env show

Displays the stored env

Synopsis

The show command retrieves and displays the stored env for a given file. Usage examples:

cred env show

cred env show [flags]

Options

  -h, --help   help for show

SEE ALSO

  • cred env - A command to manage env-variables

cred env copy

Copies the stored env to system clipboard

Synopsis

The show command retrieves and copies the stored env for a given file. Usage examples:

cred env copy

cred env copy [flags]

Options

  -h, --help   help for copy

SEE ALSO

  • cred env - A command to manage env-variables

cred env get

Retrieve and store environment variables

Synopsis

Retrieve environment variables from a specified file or default .env files and store them securely.

You can specify the file containing the environment variables using the -f flag. If the -f flag is not provided, the command will look for the following files in order: .env, .env.local, .env.development, .env.production, .env.test.

Example usage: cred env get [flags: -f (filepath)]
cred env get [flags]

Options

  -f, --file string   path to the file containing env
  -h, --help          help for get

SEE ALSO

  • cred env - A command to manage env-variables

cred env set

Sets environment variables from the cred-store into a .env file

Synopsis

Retrieve environment variables for a specified file from the cred-store and write them to a local .env file.

You provide the file name as an argument. The command fetches the environment variables associated with that file from the cred-store and writes them into a new or existing .env file in your current directory.

Example usage: cred env set <filepath>
cred env set [flags]

Options

  -h, --help   help for set

SEE ALSO

  • cred env - A command to manage env-variables

cred pass

A command to manage passwords

Synopsis

The pass command allows you to manage your passwords efficiently. It provides functionalities to create, update, and delete passwords.

Examples:

  • Create a new password: pass {insert/generate}
  • Update an existing password: pass edit
  • Delete a password: pass rm
cred pass [flags]

Options

  -h, --help   help for pass

SEE ALSO

cred pass insert

Insert a new password entry

Synopsis

The insert command allows you to add a new password entry to the password store. You will be prompted to enter and confirm the password, which will be stored securely. If the entry already exists, you will be asked whether you want to overwrite it.

Examples: pass insert

cred pass insert [flags]

Options

  -e, --editor   open password in editor for editing extra details after insertion
  -h, --help     help for insert

SEE ALSO

cred pass generate

Generate a new password and store it securely

Synopsis

The generate command creates a new password of specified length and stores it securely in the password store. You can specify the length of the password using the -l flag. If the file already exists, you will be prompted to overwrite it.

Examples: pass generate mypassword -l 16 pass generate anotherpassword -l 24

cred pass generate [flags]

Options

      --allow-digit              should allow digits in the password (default true)
      --allow-lowercase          should allow lower-case characters in the password (default true)
      --allow-special            should allow special characters in the password (default true)
      --allow-uppercase          should allow upper-case characters in the password (default true)
      --allowed-special string   allowed special characters in the password (default "!@#$%^&*()-_=+[]{}|;:,.<>?/`~")
  -e, --editor                   open password in editor for editing extra details after insertion
  -h, --help                     help for generate
  -l, --length int               length of the generated password (default 12)

SEE ALSO

cred pass edit

Edit a password entry

Synopsis

Edit a password entry in the password store.

This command allows you to edit an existing password entry in your password store. Usage: cred pass edit

cred pass edit [flags]

Options

  -h, --help   help for edit

SEE ALSO

cred pass ls

List files and directories

Synopsis

The ls command allows you to list files and directories. It uses the 'ls' command to display the contents of the current directory.

Examples: cred pass ls

cred pass ls [flags]

Options

  -h, --help   help for ls

SEE ALSO

cred pass mv

Move files and directories

Synopsis

The mv command allows you to move files and directories. It uses the 'mv' command to move the specified file or directory to a new location.

Examples: cred pass mv

cred pass mv [flags]

Options

  -h, --help   help for mv

SEE ALSO

cred pass cp

copies files and directories

Synopsis

The cp command allows you to copies files and directories. It uses the 'cp' command to move the specified file or directory to a new location.

Examples: cred pass cp

cred pass cp [flags]

Options

  -h, --help   help for cp

SEE ALSO

cred pass mkdir

Create directories

Synopsis

The mkdir command allows you to create directories, including nested directories. It uses the 'mkdir' command to create the specified path.

Examples: cred pass mkdir

cred pass mkdir [flags]

Options

  -h, --help   help for mkdir

SEE ALSO

cred pass rm

Remove files and directories

Synopsis

The rm command allows you to remove files and directories recursively. It uses the 'rm' command to delete the specified path.

Examples: cred pass rm

cred pass rm [flags]

Options

  -h, --help   help for rm

SEE ALSO

cred pass show

Displays the stored password

Synopsis

The show command retrieves and displays the stored password for a given account. Usage examples:

cred pass show <account_path>

cred pass show [flags]

Options

  -h, --help   help for show

SEE ALSO

cred pass copy

Copies the stored password to system clipboard

Synopsis

The show command retrieves and copies the stored password for a given account, Usage examples:

cred pass show

cred pass copy [flags]

Options

  -h, --help   help for copy

SEE ALSO

cred ssh

Manage SSH keys and connections

Synopsis

The ssh command allows you to manage SSH keys and establish connections. It provides functionalities to add keys, list keys, and connect to servers.

Examples:

  • Add a new SSH key: ssh add
  • List all SSH keys: ssh ls
  • Connect to a server: ssh connect
cred ssh [flags]

Options

  -h, --help   help for ssh

SEE ALSO

cred ssh insert

Insert a new ssh entry

Synopsis

The insert command allows you to add a new ssh entry to the ssh store. You will be prompted to enter and confirm the ssh, which will be stored securely. If the entry already exists, you will be asked whether you want to overwrite it.

Examples: ssh insert --public-key --private-key --connection

cred ssh insert [flags]

Options

      --connection-string string   connection string
  -h, --help                       help for insert
      --private-key string         private key file path
      --public-key string          public key file path

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred ssh generate

Generate a new SSH key pair and save it securely

Synopsis

The generate command allows you to create a new SSH key pair and store it in the credential store. You can optionally add a connection string during generation.

Example: cred ssh generate --connection

cred ssh generate [flags]

Options

      --connection-string string   connection string
  -h, --help                       help for generate

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred ssh edit

edit a new ssh entry

Synopsis

The edit command allows you to add a new ssh entry to the ssh store. You will be prompted to enter and confirm the ssh, which will be stored securely. If the entry already exists, you will be asked whether you want to overwrite it.

Examples: ssh edit --public-key --private-key --connection

cred ssh edit [flags]

Options

      --connection-string string   connection string
  -h, --help                       help for edit
      --private-key string         private key file path
      --public-key string          public key file path

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred ssh connect

Establish SSH connection using stored connection string and private key

Synopsis

Looks for the 'connection.gpg' and 'private.gpg' files stored under the given in the cred store. Decrypts these files and uses the connection string and private key to establish an SSH connection to the remote server.

Example: cred ssh connect my-server This will look for: my-server/connection.gpg my-server/private.gpg and use the decrypted contents to connect.

cred ssh connect [flags]

Options

  -h, --help   help for connect

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred ssh cp

copies files and directories

Synopsis

The cp command allows you to copies files and directories. It uses the 'cp' command to move the specified file or directory to a new location.

Examples: cred ssh cp

cred ssh cp [flags]

Options

  -h, --help   help for cp

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred ssh mv

Move files and directories

Synopsis

The mv command allows you to move files and directories. It uses the 'mv' command to move the specified file or directory to a new location.

Examples: cred ssh mv

cred ssh mv [flags]

Options

  -h, --help   help for mv

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred ssh download

Download SSH key files for the specified entry

Synopsis

The download command retrieves SSH key files (public, private, and connection info) for a given SSH entry and saves them into a 'downloads' directory.

Example: cred ssh download my-key-name This will create: downloads/my-key-name/public.key downloads/my-key-name/private.key downloads/my-key-name/connection.txt

cred ssh download [flags]

Options

  -h, --help   help for download

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred ssh ls

List files and directories

Synopsis

The ls command allows you to list files and directories. It uses the 'ls' command to display the contents of the current directory.

Examples: cred ssh ls

cred ssh ls [flags]

Options

  -h, --help   help for ls

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred ssh mkdir

Create directories

Synopsis

The mkdir command allows you to create directories, including nested directories. It uses the 'mkdir' command to create the specified path.

Examples: cred ssh mkdir

cred ssh mkdir [flags]

Options

  -h, --help   help for mkdir

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred ssh rm

Remove files and directories

Synopsis

The rm command allows you to remove files and directories recursively. It uses the 'rm' command to delete the specified path.

Examples: cred ssh rm

cred ssh rm [flags]

Options

  -h, --help   help for rm

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred ssh show

Displays the stored ssh

Synopsis

The show command retrieves and displays the stored ssh key for a given file. Usage examples:

cred ssh show

cred ssh show [flags]

Options

  -h, --help   help for show

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred ssh copy

Copies the stored ssh to system clipboard

Synopsis

The show command retrieves and copies the stored ssh key for a given file. Usage examples:

cred ssh copy

cred ssh copy [flags]

Options

  -h, --help   help for copy

SEE ALSO

  • cred ssh - Manage SSH keys and connections

cred completion

Generate the autocompletion script for the specified shell

Synopsis

Generate the autocompletion script for cred for the specified shell. See each sub-command's help for details on how to use the generated script.

Options

  -h, --help   help for completion

SEE ALSO

cred completion bash

Generate the autocompletion script for bash

Synopsis

Generate the autocompletion script for the bash shell.

This script depends on the 'bash-completion' package. If it is not installed already, you can install it via your OS's package manager.

To load completions in your current shell session:

source <(cred completion bash)

To load completions for every new session, execute once:

Linux:

cred completion bash > /etc/bash_completion.d/cred

macOS:

cred completion bash > $(brew --prefix)/etc/bash_completion.d/cred

You will need to start a new shell for this setup to take effect.

cred completion bash

Options

  -h, --help              help for bash
      --no-descriptions   disable completion descriptions

SEE ALSO

  • cred completion - Generate the autocompletion script for the specified shell

cred completion zsh

Generate the autocompletion script for zsh

Synopsis

Generate the autocompletion script for the zsh shell.

If shell completion is not already enabled in your environment you will need to enable it. You can execute the following once:

echo "autoload -U compinit; compinit" >> ~/.zshrc

To load completions in your current shell session:

source <(cred completion zsh)

To load completions for every new session, execute once:

Linux:

cred completion zsh > "${fpath[1]}/_cred"

macOS:

cred completion zsh > $(brew --prefix)/share/zsh/site-functions/_cred

You will need to start a new shell for this setup to take effect.

cred completion zsh [flags]

Options

  -h, --help              help for zsh
      --no-descriptions   disable completion descriptions

SEE ALSO

  • cred completion - Generate the autocompletion script for the specified shell

cred completion fish

Generate the autocompletion script for fish

Synopsis

Generate the autocompletion script for the fish shell.

To load completions in your current shell session:

cred completion fish | source

To load completions for every new session, execute once:

cred completion fish > ~/.config/fish/completions/cred.fish

You will need to start a new shell for this setup to take effect.

cred completion fish [flags]

Options

  -h, --help              help for fish
      --no-descriptions   disable completion descriptions

SEE ALSO

  • cred completion - Generate the autocompletion script for the specified shell

cred completion powershell

Generate the autocompletion script for powershell

Synopsis

Generate the autocompletion script for powershell.

To load completions in your current shell session:

cred completion powershell | Out-String | Invoke-Expression

To load completions for every new session, add the output of the above command to your powershell profile.

cred completion powershell [flags]

Options

  -h, --help              help for powershell
      --no-descriptions   disable completion descriptions

SEE ALSO

  • cred completion - Generate the autocompletion script for the specified shell