0.2.0 • Published 9 years ago

basher v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

Basher.js Build Status

Run any command or shell script anywhere, in any order.

Basic "hello" task

bin/run:

#!/usr/bin/env node

require("../lib/runner")().run()

lib/runner.js:

import { command } from "basher"

class Runner {
  constructor(state) {
    this.state({
      task:  state.options._[0],
      tasks: this.commands
    })
  }

  help(state) {
    console.log(`Usage: ./bin/run [task]`)
  }

  run(state) {
    return this.tasks(state)
  }
}

export default command(Runner).include(__dirname)

lib/commands/hello.js:

import { command } from "basher"

export default command(class {
  description() {
    return "hello description"
  }

  help(state) {
    console.log(`Usage: ./bin/run hello`)
  }

  run() {
    console.log("hello!")
  }
})