Code Monkey home page Code Monkey logo

run's Introduction

run

Every build system has a different approach to handling the tasks that you need to run often for your project. With make each task would become a different recipe. With npm you would use npm run. With cargo the most common tasks are a subcommand. But then say you have an uncommon thing you need to do a lot, or you need to pass an extra argument to cargo run every time, then cargo can't help you with that. So I often find myself creating a makefile for my Rust projects. But then if I want to be able to pass arguments to the recipes, make doesn't allow for that. The whole thing is a big mess.

run is intended to be a more unified solution to the common scenario of "I have some tasks that I want to run often in this directory". The idea is that you write your tasks as regular bash functions in a file named runfile in the directory where you plan to run them. Then you use run to run tasks from your runfile. Similar to make, if you execute run with no arguments then it runs the task called all. run also lets you pass arguments to your tasks.

Installation

run is a 9 line bash script. Installation is easy, you can just copy and paste the script into a file on your path. This command will do it for you:

curl https://raw.githubusercontent.com/akriegman/run/main/run >~/bin/run ; chmod +x ~/bin/run

Or, if you have a project with a runfile but you don't have run installed, you just run the tasks as ordinary bash functions, for example:

$ . runfile
$ all

This has the disadvantage of polluting your bash session.

Example

Here's an example runfile from a project of mine: https://github.com/akriegman/electro/blob/main/runfile

Notes

Including a hashbang #!/bin/bash on the first line of your runfile may help your editor recognize your runfile as bash for syntax highlighting and formatting. This hashbang will not be used with either invocation method, however.

Many people prefer Makefile over makefile because it appears higher in most file explorers. As a terminal user, this doesn't help me as ls mixes capital and lowercase files. Further, Makefile is harder to type and I find makefile more aesthetic. For these reasons I prefer lowercase, and I guess for simplicity run only acknowledges runfiles, not Runfiles.

https://github.com/TekWizely/run and https://github.com/simpzan/run had the same idea as me with the same name. My version is the most minimal of the three, but if you want more features then check them out.

run's People

Contributors

akriegman avatar

Stargazers

 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.