Skip to main content

A tool for centralizing scripted shell commands via a configurable JSON or YAML file

Project description

prog

A tool for centralizing scripted shell commands via a configurable JSON or YAML file.

Table of Contents

  1. Downloading and Installing
  2. Usage
  3. Future Plans

Downloading and Installing

Downloading

prog is currently available as a GitHub repository, and can be cloned using the following command: git clone https://github.com/bdreece/prog.git

Installing

prog is packaged via the setup script, and can be installed using the following command: cd prog; pip install .

Congratulations! You should now have prog installed on your system!

Usage

Help Page

The help page for prog can be displayed in the following manner: prog --help

This will display the following information:

Usage: prog [OPTIONS] [COMMANDS]...

  A command line utility for centralizing scripted shell commands via a
  configurable JSON or YAML file

Options:
  -j, --json       Use JSON config file
  -y, --yml        Use YAML config file
  -g, --generate   Create a config file
  -e, --edit       Edit config file
  -v, --verbose    Show verbose output
  -f, --file PATH  Path to config file
  -V, --version    Show the version and exit.
  -h, --help       Show this message and exit.

JSON Config File

A default JSON file can be generated using the prog -jg command, optionally specifying an output file with prog -jgf <PATH> (default: ./prog.json). This file is based on a C-style project, with commands listed for building, running, and debugging a project, and is configured as follows:

{
  "build": "make all",
  "run": "./main",
  "debug": "gdb ./main"
}

The aliased command hooks are listed in the keys of the JSON file, and their corresponding shell commands are the respective values of the JSON file.

YAML Config File

A default YAML file can be generated using the prog -yg command, optionally specifying an output file with prog -ygf <PATH> (default: ./prog.yml). This file is based on a C-style project, with commands listed for building, running, and debugging a project, and is configured as follows:

 build: make all
 run: ./main
 debug: gdb ./main

The aliased command hooks are listed in the keys of the YAML file, and their corresponding shell commands are the respective values of the YAML file.

Config File Structure

The prog tool supports nested subcommands and lists of shell commands. These can be written in the form of nested objects and nested lists, respectively. Examples in JSON and YAML are as follows:

{
    "config": {
        "debug": "cmake -DCMAKE_BUILD_TYPE=Debug -B build -G Ninja .",
        "release": "cmake -DCMAKE_BUILD_TYPE=Debug -B build -G Ninja ."
    },
    "build": "cd build; ninja",
    "push": [
        "git add .",
        "git commit",
        "git push"
        "git status"
    ]
}
config:
    debug: cmake -DCMAKE_BUILD_TYPE=Debug -B build -G Ninja .
    release: cmake -DCMAKE_BUILD_TYPE=Release -B build -G Ninja .
build: cd build; ninja
push:
    - git add .
    - git commit
    - git push
    - git status

Invocation

Once the JSON file has been configured to your needs, you can simply invoke the custom commands using the following command: prog [COMMANDS]...

Multiple commands may be specified, and will execute in the order they are specified.

If nested subcommands are present, the prog tool expects exactly one command per layer of nesting. Try enabling verbose output if issues arise.

Future Plans

With the addition of advanced object structures to prog's parser, I can see a lot more use cases for this style of program. I plan to update this project incrementally as I get ideas for more intuitive behavior.

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

If you're not sure about the file name format, learn more about wheel file names.

prog_0.1.2-0.1.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file prog_0.1.2-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: prog_0.1.2-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for prog_0.1.2-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4ebc79bbe6c5e0177ef38dadbffc3c40964082998734f0f6609eb6dd625856d8
MD5 e7149ef5719bd56bb1017cf01aaf7ef7
BLAKE2b-256 367d1a004ba2a66b759d710d15465d47ed1b7b6f7e5d4d69e3009b32581afb39

See more details on using hashes here.

Supported by

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