denisidoro / beavr

A command-line autocompleter with steroids :muscle:

Home Page:https://www.npmjs.com/package/beavr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

beavr

CircleCI npm version Downloads

A command-line autocompleter with steroids. 💪

Based on the desired command spec, beavr suggests arguments and flags. Suggestions can be selected with fzf, a fuzzy-finder.

Demo

⚠️ If you're interested in this project you will probably like navi!

The main objectives are:

  • to increase discoverability, by showing all possible actions you can take;
  • to prevent you from running auxiliar commands, copying the result into the clipboard and then pasting into the original command;
  • to improve terminal usage as a whole.

Sure, you can find autocompleters out there for all your favorite commands.

However, they are very specific and each one may offer a different learning curve.

beavr, on the other hand, intends to be a general purpose platform for speccing any command with a couple of lines.

Installation

brew install fzf # or equivalent
npm install -g beavr

Usage

It's planned for beavr to ship with some command specs and, in case the command isn't available, beaver should infer the spec given the command's --help content.

In the meantime, you must define a <your-cmd>.sh in $HOME/.config/beavr/ such as in these examples:

beavr::help() {
  echo "kubectl controls the Kubernetes cluster manager
Usage:
  kubectl get <resource>
  kubectl describe <resource> <id>"
}

beavr::suggestion() {
  case "$1" in 
    "resource") echo "pods nodes deployments" | tr ' ' '\n';;
    "id") kubectl get $resource | tail -n +2;;
  esac
}

As of now, they must conform to neodoc/docopt specifications.

ZSH widget

Simply source this file in your .zshrc.

By default, the widget is trigged by Alt + G.

Widgets for other shells

While there is no widget for other shells, please run:

beavr <your-cmd> | pbcopy # or similar clipboard tool
# paste into the command line

Roadmap

Refer to this dashboard.

Feel free to add new issues or to upvote existing ones.

Etymology

Command-line call builder > builder > beaver > beavr.

Icon

Icon made by Freepik from flaticon, licensed by CC 3.0 BY.

About

A command-line autocompleter with steroids :muscle:

https://www.npmjs.com/package/beavr


Languages

Language:Clojure 93.3%Language:Shell 6.7%