1.0.2 • Published 2 years ago
@orloxx/cpc v1.0.2
██████╗██████╗ ██████╗
██╔════╝██╔══██╗██╔════╝
██║ ██████╔╝██║
██║ ██╔═══╝ ██║
╚██████╗██║ ╚██████╗
╚═════╝╚═╝ ╚═════╝ v1.0.2A program that suggest scripts depending on the context.
npm install -g @orloxx/cpcUsage
Run
It looks for scripts in the current directory and suggests them to later run
them. It accepts a command to directly run it without suggestions. It also
accepts arguments to pass to the script.
$ cpc run [-s] [<script>] [-- <arguments>]-s,--silent(optional) - Will not print any hint from CPC.<script>(optional) - If you already know the script you want to run, you can directly pass it. It will run silently by default.<arguments>(optional) - Everything after--will be passed to the<script>.
Where does it take it the scripts from?
- From any global configuration in usage – see Load
- From the
.cpcrcfile in the current directory – see Configure - From the
package.jsonfile in the current directory
Load
It loads a set of scripts to be used globally, no matter in which directory they're executed
$ cpc load [<filepath>]<filepath>(optional) - The path to the script file. If not provided, it will look for a.cpcrcfile in the current directory. It supports different file formats:.cpcrc- JSON format.cpcrc.json.cpcrc.js- JavaScript format
:warning: If you load a script file with the same name property, scripts will
be overwritten.
Configure
There's a sample .cpcrc file in the root directory of the project:
{
"name": "cpc-sample",
"description": "Sample configuration file for cpc",
"scripts": {
"hello": "echo \"Hello world!\"",
"list-home": {
"path": "~/",
"command": "ls -la",
"description": "List home directory contents"
}
}
}You can try running cpc run and you'll get a list of suggestions with 2
options: hello and list-home.
list-home is a script that runs ls -la in the home directory defined by
path. It also includes a description.