Skip to content
/ shelf Public

Your personal CLI bookshelf for storing and recalling useful commands.

License

Notifications You must be signed in to change notification settings

maytees/shelf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shelf

Your personal CLI bookshelf for storing and recalling useful commands. Shelf allows you to store commands in their respective collections, created by you.

No more "I know I used this command last month, but what was it again?" moments

Installing with Cargo

View the crates.io page here

Requirements:

  • Cargo/Rust
  1. Cargo install

Install the shelf binary:

cargo install shelf-cli

The install might give you a warning:

Be sure to add /path/to/.cargo/bin (it will tell you) to your PATH to be able to run the installed binaries.

Building from source

Requirements:

  • Rust
  • Git (ofc)
  1. Clone the repo
git clone https://github.com/maytees/shelf
  1. Build it
cargo build

How to use

Saving a command

This will store a command to the global collection.

shelf stack -d "Prints out HOME env var" echo $HOME

To stack a command with tags, specifiy with the -t flag.

shelf stack -d "Builds a NextJS Project" -t nextjs,npx,npm npx next build

Listing commands

By default, this will act similar to shell history, and print out saved commands in order. Use the --verbose flag to display the command description, and tags in addition to just the id and command

shelf list

Options

-v, --verbose        In addition to ID, and command, display tags, and description

-r, --reverse        Reverse the order of the listed commands

-l, --limit <LIMIT>  Limit the order of the listed commands

Running a command

Tip

If a command is saved with an environment variable, the variable will be evaluated when you run the command. If you wish to evaluate the variable when you stack the command, use your shell's method of entering variables as plain strings. For example in zsh you add a \ before the variable: \$HOME.

Currently, there are two ways to fetch commands in shelf:

  1. Running
  2. Copying to clipboard

Running

To run a command, first find the id of the command via shelf list

shelf run <ID>

Copying to clipboard

Copying to clipboard may not seem all that useful right now, but it may come in handy someday, so it's there for you to use.. :)

shelf run -c <ID>

Fuzzy searching

You are able to fuzzy search commands to either run them or copy them.

Run via fuzzy search

shelf fuzz

Copying to clipbaord via fuzzy search

shelf fuzz -c

image

Config

The configuration for shelf is currently very limited. Here is what is configurable at the moment:

Auto Verbose

Automatically outputs verbose list of commands (default: false)

auto_verbose = false

Todo

  • Save
    • Stack globally
    • Stack to a collection
    • Stack with tags
  • List
    • List a collection
    • Reverse flag
    • Limit flag
    • Verbose flag
      • Description
      • Tags
      • Collection
  • Run commands
    • Via search
    • Via id (similar to shell history)
    • Copy command via flag
  • Search
    • Fuzzy search
    • Search by tag
    • Search a collection by tag
  • Shell history integration
    • (note: in the short term, this can be achieved with something akin to shelf stack -d "command" $(history $NUMBER_TO_STORE_IF_APPLICABLE | tail -n 1 | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}'))
  • Colored output (for readability)
  • Run Command on store
    • Save command output
      • Store x lines of output
  • Much more...

About

Your personal CLI bookshelf for storing and recalling useful commands.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages