Skip to content

Commit

Permalink
Fix meow configuration for default values (#3066)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeddy3 committed Dec 15, 2017
1 parent 1901967 commit 6b70bd5
Showing 1 changed file with 82 additions and 86 deletions.
168 changes: 82 additions & 86 deletions lib/cli.js
Expand Up @@ -9,7 +9,10 @@ const path = require("path");
const resolveFrom = require("resolve-from");
const standalone = require("./standalone");

/*:: type minimistOptionsType = {
/*:: type meowOptionsType = {
autoHelp: boolean,
autoVersion: boolean,
help: string,
flags: {
"allow-empty-input": {
alias: string,
Expand Down Expand Up @@ -46,6 +49,7 @@ const standalone = require("./standalone");
},
formatter: {
alias: string,
default: "string",
type: string
},
help: {
Expand Down Expand Up @@ -83,13 +87,7 @@ const standalone = require("./standalone");
alias: string,
type: string
}
}
}*/

/*:: type meowOptionsType = {
autoHelp: boolean,
autoVersion: boolean,
help: string,
},
pkg: string,
} */

Expand Down Expand Up @@ -139,83 +137,6 @@ const standalone = require("./standalone");
ignorePattern?: any
}*/

const minimistOptions /*: minimistOptionsType*/ = {
flags: {
"allow-empty-input": {
alias: "aei",
type: "boolean"
},
cache: {
type: "boolean"
},
"cache-location": {
type: "string"
},
config: {
default: false,
type: "string"
},
"config-basedir": {
type: "string"
},
color: {
type: "boolean"
},
"custom-formatter": {
type: "string"
},
"custom-syntax": {
type: "string"
},
"disable-default-ignores": {
alias: "di",
type: "boolean"
},
fix: {
type: "boolean"
},
formatter: {
alias: "f",
type: "string"
},
help: {
alias: "h",
type: "boolean"
},
"ignore-disables": {
alias: "id",
type: "boolean"
},
"ignore-path": {
alias: "i"
},
"ignore-pattern": {
alias: "ip"
},
"no-color": {
type: "boolean"
},
"report-needless-disables": {
alias: "rd"
},
"stdin-filename": {
type: "string"
},
quiet: {
alias: "q",
type: "boolean",
default: false
},
syntax: {
alias: "s"
},
version: {
alias: "v",
type: "boolean"
}
}
};

const meowOptions /*: meowOptionsType*/ = {
autoHelp: false,
autoVersion: false,
Expand Down Expand Up @@ -334,10 +255,85 @@ const meowOptions /*: meowOptionsType*/ = {
Show the currently installed version of stylelint.
`,
flags: {
"allow-empty-input": {
alias: "aei",
type: "boolean"
},
cache: {
type: "boolean"
},
"cache-location": {
type: "string"
},
config: {
default: false,
type: "string"
},
"config-basedir": {
type: "string"
},
color: {
type: "boolean"
},
"custom-formatter": {
type: "string"
},
"custom-syntax": {
type: "string"
},
"disable-default-ignores": {
alias: "di",
type: "boolean"
},
fix: {
type: "boolean"
},
formatter: {
alias: "f",
default: "string",
type: "string"
},
help: {
alias: "h",
type: "boolean"
},
"ignore-disables": {
alias: "id",
type: "boolean"
},
"ignore-path": {
alias: "i"
},
"ignore-pattern": {
alias: "ip"
},
"no-color": {
type: "boolean"
},
"report-needless-disables": {
alias: "rd"
},
"stdin-filename": {
type: "string"
},
quiet: {
alias: "q",
type: "boolean",
default: false
},
syntax: {
alias: "s"
},
version: {
alias: "v",
type: "boolean"
}
},
pkg: require("../package.json")
};

const cli /*: cliType*/ = meow(meowOptions, minimistOptions);
const cli /*: cliType*/ = meow(meowOptions);

let formatter = cli.flags.formatter;
if (cli.flags.customFormatter) {
Expand Down

0 comments on commit 6b70bd5

Please sign in to comment.