Skip to content

Mesh between shell history, man manual and github.

License

Notifications You must be signed in to change notification settings

shearch/shearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shearch

Build status

Table of Contents

About

shearch wants to be easier to use shell's history. It is highly customizable meaning you can add your own commands, quickly navigate through them and recall them simply by entering a few key tags. It offers you in-place editing of command's arguments by pressing TAB key to cycle through them. When satisfied hitting RETURN will push chosen command to the command line without executing it! The most convenient way to use shearch is by binding it to a shortcut key. By default F12 is used.

Contribute

Share your commands with the rest of us. How? Look at add your own commands section. When you are ready to share follow this steps:

$ cd ~
$ git clone git@github.com:myusername/shearch.git # Replace myusername with your username on github
  • Add upstream so you are always up to date!
$ cd .shearch
$ git remote add upstream git://github.com/shearch/shearch.git
  • Create your branch
$ git branch mycommands # name of your branch
  • Checkout (migrate) to your branch.
$ git checkout mycommands # move to your branch
$ git add ~/.shearch/src/db/mycommands.json
  • Commit your newly added commands.
$ git commit ~/.shearch/src/db/mycommands.json -m "Added commands to list directories."
  • When all work is done on that issue, make sure you commit all the changes.
$ git commit -a -m "Final commit before push."
  • Always update from main repository before submiting pull request.
$ git checkout master # Move to your master branch.
$ git fetch upstream # Get latest code.
$ git merge upstream/master # Merge upstream master with your local master.
$ git push origin master # Merge upstream master with your remote fork.
$ git checkout mycommands # Move back to your mycommands branch.
$ git merge master # Update your mycommands branch with latest code.
$ git push origin mycommands # Push mycommands to your remote fork.
  • Create pull request from github.

Installation

  • from curl
$ curl -o install.sh -L https://github.com/shearch/shearch/raw/master/tools/install.sh && . ./install.sh
  • from wget
$ wget --no-check-certificate https://github.com/shearch/shearch/raw/master/tools/install.sh && . ./install.sh
  • manually (rather use one of the above)
$ cd ~
$ git clone git://github.com/shearch/shearch.git ~/.shearch
$ . ~/.shearch/tools/install.sh

Requirements

Python. Currently bash and zsh shells are supported.

Usage

Press F12, choose a command and press RETURN.

Features

shearch uses standard EMACS(?) style navigation:

ALT_B: Back, left one word.
ALT_F: Forward, right one word.
CTRL_A: Beginning of the line (Home).
CTRL_B: Back one character.
CTRL_D: Delete.
CTRL_E: End of the line (End).
CTRL_F: Forward one character.
CTRL_H: Backspace.
CTRL_K: Cut line after cursor to clipboard.
CTRL_U: Cut line before cursor to clipboard.
CTRL_W: Cut word before cursor to clipboard.
CTRL_Y: Yank (paste). DSUSP, delayed suspend on BSD-based systems.

Cycle through arguments.

TAB: Cycle through command arguments. SHIFT_TAB: Reverse cycle through command arguments.

Add your own commands

  • Create a file in ~/.shearch/src/db/ ending with .json suffix.
{
    "command"     : "find . -name \"*.txt\"",
    "description" : "Finds all txt files in current directory.",
    "nix_edit"    : {
                        "mask": "find %s -name \"%s\"",
                        "args": [".", "*.txt"]
                    },
    "tag"         : ["find", "search", "locate", "text", "files"]
}

JSON database structure. Single item contains:

command - plain command typed in a command line,
description - Describe what command does.
nix_edit - Mask marks edible arguments. Args is an array providing default values for those arguments.
tag -  comma separated tags

Please see provided sample files curl and example to make it clearer.

About

Mesh between shell history, man manual and github.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published