cmds
is a command-line tool designed to store CLI commands for quick access and usage.
Think of it as a simple notes app specifically tailored for storing commands using
customizable keys.
Oftentimes, we find ourselves needing to store certain commands for later use. These may be commands that are not easily remembered or ones that we find useful but don't want to keep looking up. Traditionally, we might store these commands in a file and then copy and paste them into the terminal when needed. Recognizing the need for a more efficient solution, I decided to create a CLI application to streamline this process.
You can find the project on pip.
- Store CLI commands with custom keys for easy retrieval.
- Quickly access stored commands with fuzzy search without the need to search through files.
- Organize commands based on your workflow or preferences.
- Export all commands into a JSON file.
Using pip.
pip install command-storage
Using brew. Gem file maintained in repository homebrew-command-storage.
brew tap ashu-tosh-kumar/command-storage
brew install command-storage
Using pipx.
pipx install command-storage
NOTE: Initialize the application by running cmds init
. Note that if you want to have
cross platform sync of data, you can choose location of file to be inside a drive
installed on your system like Onedrive.
Seeking help.
cmds --help
Storing some commands into the cmds
.
cmds store --key "count no of files" --command "ls | wc -l" --description "count no of files in a directory"
cmds store --key "run python test with cov" --command "pytest --cov --cov-report term --cov-report xml:coverage.xml" --description "pytest with cov"
Viewing all commands stored in cmds
.
cmds list
cmds [OPTIONS] COMMAND [ARGS]...
Options:
-v, --version
: Show cmds version.--help
: Show this message and exit.
Commands:
delete
: Allows deletion of stored command by keyexport
: Exports all stored commands into a JSON file.init
: Initialize the application.list
: Show list of all stored commands.store
: Store a new command into cmds.update
: Allows updating a stored command by its key.
Allows copying a command by its key.
Usage:
cmds copy [OPTIONS] [KEY]
Arguments:
[KEY]
: Key for the command.
Options:
--help
: Show this message and exit.
Allows deletion of stored command by key
Usage:
cmds delete [OPTIONS] [KEY]
Arguments:
[KEY]
Options:
-a, --all
: Delete all commands--help
: Show this message and exit.
Exports all stored commands into a JSON file.
Usage:
cmds export [OPTIONS]
Options:
-f, --file TEXT
: Export file address with extension [default: command_storage_export_2024-02-28 19:37:47.575256.json]--help
: Show this message and exit.
Initialize the application. One time process and uses existing config and data files if available.
Args:
db_path (str, optional): --db-path
argument. Defaults to_INITIAL_DB_PATH.
Raises: typer.Exit: If error in app initialization typer.Exit: if error in database file initialization
Usage:
cmds init [OPTIONS]
Options:
-db, --db-path TEXT
: [default: <home_path>.<home_path_name>_cmds.json]--help
: Show this message and exit.
Show list of all stored commands. Also supports fuzzy matching on key. Run 'cmds list --help' to see how.
Usage:
cmds list [OPTIONS] [KEY]
Arguments:
[KEY]
: Key for the command.
Options:
-
-l, --limit INTEGER
: Number of results to show. 0 means all results. [default: 5] -
--help
: Show this message and exit.
Store a new command into cmds by giving a helpful key name to refer to.
Usage:
cmds store [OPTIONS]
Options:
-k, --key TEXT
: Key for the command. [required]-c, --command TEXT
: Command to be stored. [required]-des, --description TEXT
: Description of command to be stored.--help
: Show this message and exit.
Allows updating a stored command by its key. Also supports changing the key.
Usage:
cmds update [OPTIONS] ORIG_KEY
Arguments:
ORIG_KEY
: [required]
Options:
-k, --key TEXT
: Key for the command.-c, --command TEXT
: Command to be stored.-des, --description TEXT
: Description of command to be stored.--help
: Show this message and exit.
0.1.0
- First working release (built using Python 3.11).
0.1.1
- Lowered Python version requirement to 3.9. Added support to be installable via multiple package managers.
0.1.2
list
command useskey
as argument instead of option for wider app consistency.list
command supports passing--limit
option to limit no. of search results. Works for both with and without fuzzy search.- Added
copy
command to allow copying a command by its key. - Added a probability threshold for fuzzy search in
list
command. This helps in returning only meaningful matches. - [BUG FIX] Fixed
init
command overwriting existing database file.
- This is my first CLI based application and Real Python's article helped a lot.
- Built with ❤️ using Typer.
- Fuzzy Matching logic: TheFuzz.
- Printing in tabular format: tabulate
- CLI usage documentation generated using
typer-cli command:
typer command_storage.views.cli utils docs
.