Code Monkey home page Code Monkey logo

rav's Introduction

rav

A cross-platform Python CLI to shortcut to command-line commands. Inspired by Makefiles and npm scripts.

Install

It's recommended that you use a virtual environment with rav.

python3 -m pip install rav

Minimum python version is 3.7

Start new project

Basic Usage:

cd ~/path/to/project
rav new

Run through the setup wizard to create rav.yaml

or

Manually create rav.yaml

scripts:
    echo: echo hello world

Use:

rav run echo

Manage the Rav project rav.yaml file

The configuration block is flexible. Use rav, scripts, or commands as the top-level key.

rav.yaml

name: rav-in-sixty-seconds

scripts:
    echo: echo "this is awesome"
    server: venv/bin/python -m http.server

Or if on windows:

rav.yaml

name: rav-in-sixty-seconds

scripts:
    echo: echo this is awesome
    win-server: venv\Scripts\python -m http.server

The following all work and will run in this exact order (rav first, scripts second, commands last)

rav:
    echo: echo "this is awesome"
    server: venv/bin/python -m http.server
scripts:
    echo: echo "this is awesome"
    server: venv/bin/python -m http.server
commands:
    echo: echo "this is awesome"
    server: venv/bin/python -m http.server

Basic Syntax

rav run <command>

rav.yaml:

scripts:
    <command>: echo "this is a command"

Basic Example

rav.yaml:

scripts:
    hello: echo hello world!
rav run hello

By default, rav run will look for a rav.yaml file in the current directory. You can customize it, with -f as explained below.

Try the built-in Sample

rav sample

This will output rav.sample.yaml in the current directory.

rav run -f rav.sample.yaml echo

-f is used to specify a custom rav file as documented below.

Run a command

rav run echo

Or

rav run server

Or (if windows):

rav run win-server 8080

Custom Rav File

Rav supports custom yaml files by default. The yaml declaration needs to be any of the following:

  • rav
  • scripts
  • commands

project.yaml

rav:
    sweet: echo "this is working"
    echo: echo "so is this"

rav.basic.yaml

scripts:
    sweet: echo "this is working"
    echo: echo "so is this"
rav run -f project.yaml sweet

or

rav run --file rav.other.yaml echo

Here's a few rules for custom files:

  • -f or --file is used to specify a custom rav file
  • -f or --file must be used prior to the command shortcut name (e.g. rav run -f <your-new-file> <your-command>)

Multiple Commands at Once

rav.yaml

scripts:
    multi: 
        - echo this is
        - echo awesome
        - echo simple
        - echo and 
        - echo easy

Run with:

rav run multi

This is the same as running:

echo this is && echo awesome && echo simple && echo and && echo easy

rav's People

Contributors

jmitchel3 avatar patrick91 avatar teamcfe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.