DEV Community

Cover image for Jarvis
Konda Sandeep
Konda Sandeep

Posted on

Jarvis

Jarvis

Jarvis is a CLI tool and npm package for creating custom command aliases. Instantly turn lengthy or complex shell commands into simple shortcuts, boosting your productivity in the terminal.


Features

  • Add Aliases: Map any shell command to an easy-to-remember alias, with optional directory path for execution.
  • Remove Aliases: Delete aliases you no longer need.
  • List Aliases: View all your defined aliases, including their execution paths.
  • Run Aliases: Execute commands using your defined shortcuts.
  • Silent Mode: Run commands without displaying output.

Installation

Install Jarvis globally from npm:

npm install -g @sandeepk1729/jarvis
Enter fullscreen mode Exit fullscreen mode

Usage

Help

jarvis --help
Enter fullscreen mode Exit fullscreen mode
Usage: jarvis [options] [command] <string...>

used to run alias commands

Arguments:
  string        alias command

Options:
  -V, --version  output the version number
  -s, --silent  run command silently
  -h, --help    display help for command

Commands:
  alias         Add a new alias
  remove        Remove an existing alias
  list          List all aliases
Enter fullscreen mode Exit fullscreen mode

Adding an Alias

jarvis alias
Enter fullscreen mode Exit fullscreen mode

You will be prompted:

  • What is the command to alias? (e.g. echo "hello world")
  • What is the alias command? (e.g. hello)
  • Is there any specific path for the command run? (e.g. /Users/SandeepK1729/Projects) (Optional - It will run in the current directory if not specified)

Example Interaction:

◇  What is the command to alias?
│  echo "hello world"
│
◇  What is the alias command ?
│  hello
│
◇  Is there any specific path for the command run? (Optional - It will run in the current directory if not specified)
│  /Users/SandeepK1729/Projects
│
◇  Added alias 'hello' to run command: 'echo "hello world"'
Enter fullscreen mode Exit fullscreen mode

Running an Alias

jarvis hello
Enter fullscreen mode Exit fullscreen mode

If a path was provided while creating the alias, the command runs in that directory; otherwise, it runs in the current working directory.

Output:

> Running command:
> echo "hello world"
> PID: 123

"hello world"
Enter fullscreen mode Exit fullscreen mode

Listing Aliases

jarvis list
Enter fullscreen mode Exit fullscreen mode

Sample Output:

┌───────────┬────────────────────────────────────┬────────────────────────────────────────────────────────────────────────┐
│ (index)   │ command                            │ path                                                                   │
├───────────┼────────────────────────────────────┼────────────────────────────────────────────────────────────────────────┤
│ hello     │ 'echo "hello world"'               │ '/Users/SandeepK1729/Projects'                                         │
└───────────┴────────────────────────────────────┴────────────────────────────────────────────────────────────────────────┘
Enter fullscreen mode Exit fullscreen mode

Removing an Alias

jarvis remove
Enter fullscreen mode Exit fullscreen mode

You will be prompted to select which alias(es) to delete.

Example Interaction:

◇  Select aliases to delete
│  hello
│
◇  Removed alias 'hello'
Enter fullscreen mode Exit fullscreen mode

Version Check

jarvis --version
Enter fullscreen mode Exit fullscreen mode

This command will display the current version of Jarvis installed on your system.


Top comments (0)