1.0.1 • Published 4 years ago

cli-flare v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Flare CLI

A feature-rich command-line interface designed for scripting and regular use.

See /docs for the backlog, the pull request policy, the command documentation, the source code documentation, and the plugin development guide.

Quickstart

Install the CLI with the following:

npm i cli-flare -g

That's all! Commands are prefixed with a dollar sign ($). To see whether it works, execute the following in your command prompt:

$ about

To see a list of commands, go to docs/LIST_OF_COMMANDS.md or execute:

$ --help

To see the syntax and description of a command, use:

$ <command> --help

// Example
$ calc --help

Use cases

The list of commands is huge. The examples below showcase some useful commands.

Use case 1: You want to see what a string looks like when replacing a part of it.

$ replace "Hello world" "world" "earth"
> Hello earth

// Let's copy that to the console
$ copy
// The output of the previous result is now saved to the clipboard, ready to be pasted somewhere

Use case 2: You want to create a script for frequent use.

$ script createABCDirs --set "mkdir a && mkdir b && mkdir c"
// Now, every time you call '$ script createABCDirs',
// these three directories will be created in the working directory

// Scripts support arguments, too!
$ script openSocialMediaProfile --set "$ open https://socialmedia.com/profile/{@1}"

// Let's try the script with an argument
$ script openSocialMediaProfile johnny
// Opens the browser on https://socialmedia.com/profile/johnny

Use case 3: You want to remember something without creating a messy .txt file to store the reminder in.

$ note myUsernameOnGitHub JohnsonDev
// Call '$ note myUsernameOnGithub' to display 'JohnsonDev' now

Use case 4: You want to quickly solve some math without looking up an online calculator.

$ calc 5*3 + (2*4)
> 23
$ is-prime 7
> Yes, 7 is a prime number

Use case 5: You want to know how something would evaluate in JavaScript.

$ javascript "console.log(!!0 + 3 + true + 'test');"
> 4test

Use case 6: Display the files in the working directory.

$ list
> (a list of files and folders in the working directory)

See the full list of commands for an overview on the rest.

Perks

Note that the term 'Service' refers to a single command.

  • Automatically indexed commands - Adding in more commands barely affects performance.
  • Automatically detected services - Adding a new command is done by creating a new file, no configuration required. All the developer has to do is define the command and program the callback; the framework takes care of the rest.
  • Minimal amount of dependencies - Most services use built-in libraries specifically designed for this CLI, see src/utilities.
  • Implements os-specific command-line features - If you work on multiple operating systems, you can use the same command on every platform with Flare.
    • Example: linux uses xdg-open . to open the working directory, while Windows uses start . With this CLI, you can use $ here on either operating system.
  • Regular updates - GitHub issues are actively maintained, and new features, improvements, and bug fixes are added constantly.