Skip to main content

A CLI tool for managing your CLI tools

Project description

COCO

Coco is a tool for collecting commands in an easy and organized way.

Usage of arguments

Installation

Coco is available in PyPi and can be installed via pip:

pip install --user coco-cli

Features

  • Custom prompts :star2:
  • List existing prompts :notebook:
  • Add or remove prompts :cactus:
  • Easy to remember commands like ls for listing or rm for removing :bulb:

Usage

Usage: coco [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  add  Add a prompt
  ls   List all prompts
  new  Generate a default config file
  rm   Remove a prompt
  run  Run a prompt

Generate config files

To generate a new config file and simultaneously add the prompt you can simply use the command

coco new [PATH] [NAME]

Where [PATH] specifies the destination of the config file and [NAME] the name of the prompt that coco saves.

For example coco new ~/.config/coco/maven.json mvn will generate a file named maven.json in ~/.config/coco, which can be executed with coco run mvn.

Note that the name of the config file as well as the file extension do not matter. However since coco expects valid json it is a nice convention to use the .json extension.

Add prompt

If you've already created a valid config file with your desired commands you can add it via

coco add [PATH] [NAME]

Where [PATH] specifies the location of the config file and [NAME] the name of the prompt that coco saves.

See Generate Config File for a more detailed example.

Run a prompt

In order to view an added prompt simply enter

coco run [NAME]

If the prompt requires parameters you can either append them at the end or let coco ask the user for input:

Usage of arguments

And a possible config file entry could look like this

{
    "prompt": "Select command to run:",
    "choices": {
        "Show package details": "pip show {package}",
        ...
    }
}

List available prompts

To list available prompts use

coco ls

Remove a prompt

Removing an existing prompt is as easy as using:

coco rm [NAME]

[Name] of course specifies the name of the prompt that you wish to remove. To list the names of all available prompts use coco ls.

If you wish to also delete the associated config file from your system add the --delete-config flag:

coco rm --delete-config [NAME]

Config Files

An example config file can be viewed here

As you can probably guess the file needs to be valid json, however the file extension does not matter.

If you want to specify arguments for your commands you can do so by wrapping them in curly braces:

{
    "prompt": "Pacman commands:",
    "choices": {
        "install": "sudo pacman -S {package}"
    }
}

TODO

  • Support for piped operations
  • Usage of the same argument in multiple places like pip search {package} | grep {package}
  • Add new command to easily edit the config files

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

coco_cli-2.3-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file coco_cli-2.3-py3-none-any.whl.

File metadata

  • Download URL: coco_cli-2.3-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for coco_cli-2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 253620608eda7adb28dae454537f9e1f45210d1c689173d9b3efdc02c9336411
MD5 ba90755152aba5160ece3b95f6eabddc
BLAKE2b-256 71e4b46eba01086e53cafcf2c9237c586a5ccd56231d96ca2aeac7faaf575b77

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page