Skip to content

Commit

Permalink
🐎 Add format and output options to CLI sasstools#127
Browse files Browse the repository at this point in the history
  • Loading branch information
DanPurdy committed Sep 10, 2015
1 parent 0ffb7df commit b65122d
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions bin/sass-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ program
.option('-i, --ignore [pattern]', 'pattern to ignore. For multiple ignores, separate each pattern by `, `')
.option('-q, --no-exit', 'do not exit on errors')
.option('-v, --verbose', 'verbose output')
.option('-f, --format [format]', 'pass one of the available eslint formats')
.option('-o, --output [output]', 'the path and filename where you would like output to be written')
.parse(process.argv);


Expand All @@ -43,11 +45,36 @@ if (program.config && program.config !== true) {

if (program.ignore && program.ignore !== true) {
ignores = program.ignore.split(', ');
configOptions = {
'files': {
if (configOptions.hasOwnProperty('files')) {
configOptions.files.ignore = ignores;
}
else {
configOptions.files = {
'ignore': ignores
}
};
};
}
}

if (program.format && program.format !== true) {
if (configOptions.hasOwnProperty('options')) {
configOptions.options.formatter = program.format;
}
else {
configOptions.options = {
'formatter': program.format
};
}
}

if (program.output && program.output !== true) {
if (configOptions.hasOwnProperty('options')) {
configOptions.options['output-file'] = program.output;
}
else {
configOptions.options = {
'output-file': program.output
};
}
}

if (program.args.length === 0) {
Expand Down

0 comments on commit b65122d

Please sign in to comment.