Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --version cli option #87

Merged
merged 3 commits into from
Sep 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]

indent_style = space
indent_size = 2

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ Start unit tests with `npm test`, `yarn run test`, or `docker-compose -f docker-
Usage: dockerfilelint [files | content..] [options]

Options:
-o, --output Specify the format to use for output of linting results. Valid values
are `json` or `cli` (default). [string]
-j, --json Output linting results as JSON, equivalent to `-o json`. [boolean]
-h, --help Show help [boolean]
-o, --output Specify the format to use for output of linting results. Valid values
are `json` or `cli` (default). [string]
-j, --json Output linting results as JSON, equivalent to `-o json`. [boolean]
-v, --version Show version number [boolean]
-h, --help Show help [boolean]

Examples:
dockerfilelint Dockerfile Lint a Dockerfile in the current working
Expand Down
4 changes: 3 additions & 1 deletion bin/dockerfilelint
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ var argv = require('yargs')
desc: 'Output linting results as JSON, equivalent to `-o json`.',
type: 'boolean'
})
.alias('v', 'version')
.version(() => require('../package.json').version)
.help().alias('h', 'help')
.example('dockerfilelint Dockerfile', 'Lint a Dockerfile in the current working directory\n')
.example('dockerfilelint test/example/* -j', 'Lint all files in the test/example directory and output results in JSON\n')
.example(`dockerfilelint 'FROM latest'`, 'Lint the contents given as a string on the command line\n')
.example('dockerfilelint < Dockerfile', 'Lint the contents of Dockerfile via stdin')
.wrap(85)
.wrap(86)
.check(argv => {
if (!argv.output && argv.json) argv.output = 'json'
return true
Expand Down