Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

freehuntx/fuse-box-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note

As of version fuse-box@2.3.4-beta.13, FuseBox has its own CLI API!
For more informations, see: http://fuse-box.org/page/cli-api
This project is discontinued now!

fuse-box-cli

npm

Fusebox is a nice piece of software, i really like it!
There is one thing i want to do so much, and thats to give fusebox an nice CLI interface.
For this reason i created this module.

Features

  • Works with zero configuration! (Just like FuseBox)
  • Nice formatted help
  • Powerfull options api, thanks to yargs

Examples

Zero configuration

fuse.js:

const { FuseBox, Sparky } = require('fuse-box')
const { options } = require('fuse-box-cli')

Sparky.task('clean:dist', () => console.log('Cleaning...'))
Sparky.task('default', ['clean:dist'], () => console.log('Default ran!'))

Now running the script it will output something like this:

D:\Programming\Projects\some-project> node fuse -h
Usage: fuse <task> [options]

Tasks:
  clean:dist
* default      The default task

Options:
  --help, -h  Show help                                                [boolean]

Simple init

fuse.js:

const { FuseBox, Sparky } = require('fuse-box')
const { options } = require('fuse-box-cli')
  .init({
    taskDescriptions: {
      'clean:dist': 'Cleans the dist folder'
    },
    options: {
      alert: {
        desc: 'Alerts something!',
        type: 'boolean',
        default: false
      }
    }
  })

if (options.alert) {
  console.log('ALLLLEEERRRT! ALLLEEEEERRRTTT!')
  process.exit(0)
}

Sparky.task('clean:dist', () => console.log('Cleaning...'))
Sparky.task('default', ['clean:dist'], () => console.log('Default ran!'))

Now running the script it will output something like this:

D:\Programming\Projects\some-project> node fuse --alert
ALLLLEEERRRT! ALLLEEEEERRRTTT!

or

D:\Programming\Projects\some-project> node fuse -h
Usage: fuse <task> [options]

Tasks:
  clean:dist   Cleans the dist folder
* default      The default task

Options:
  --help, -h  Show help                                                [boolean]
  --alert     Alerts something!                       [boolean] [default: false]

About

Adds cli like argument handling to fusebox

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages