SimenB/stylint

View on GitHub
bin/stylint

Summary

Maintainability
Test Coverage
#!/usr/bin/env node

'use strict'

var yargs = require( 'yargs' )
var stylint = require( '../' )

var options = yargs
    .usage( 'Usage: $0 [dir | file] ' )
    .option( 'watch', {
        alias: 'w',
        describe: 'Watch file or directory and run lint on change',
        type: 'boolean'
    } )
    .option( 'config', {
        alias: 'c',
        describe: 'Location of custom config file',
        type: 'string'
    } )
    .option( 'strict', {
        alias: 's',
        describe: 'Run all tests, regardless of config',
        type: 'boolean'
    } )
    .option( 'reporter', {
        alias: 'r',
        describe: 'Custom reporter npm module name',
        type: 'string',
        requiresArg: true
    } )
    .version( function() {
        return 'Stylint version: ' + require( '../package' ).version
    } )
    .alias( 'version', 'v' )
    .help( 'help' )
    .alias( 'help', 'h' )
    .alias( 'help', '?' )
    .example( '$0 directory', 'Run Stylint on all .styl-files in "directory"' )
    .epilogue( 'GPL-3.0 License' )
    .argv

stylint().create( {}, {
    watch: options.watch,
    config: options.config,
    strict: options.strict,
    reporter: options.reporter
}, options._.length > 1 ? options._ : options._[0] )