Added --version option to tldr-lint

This commit is contained in:
pepa65 2017-06-09 10:20:10 +07:00
parent fa04d92aea
commit 809fc64f09
2 changed files with 9 additions and 7 deletions

View File

@ -78,12 +78,12 @@ Alternative location of pages cache
### Linter for new syntax tldr source files
```
Usage: tldr-lint [-h|--help] [-q|--quiet] [<dir>] [<file>]
Usage: tldr-lint [-h|--help] [-V|--version] [-q|--quiet] [<dir>] [<file>]
- All *.md files under <dir> and subdirectories are checked
- <file> is checked regardless of extension
No output means OK, unless -v or --verbose is given
-q, --quiet: No output means check is OK
-h, --help: This help text
-q, --quiet: No output means check is OK
-V, --version: Display version
-h, --help: Display this help text
```
### Prerequisites

View File

@ -14,11 +14,12 @@ Help(){ # $1: optional message
# Use: self, version
cat <<-EOC
$B$O $self$X v$version
Usage: $self [-h|--help] [-q|--quiet] [<dir>] [<file>]
Usage: $self [-h|--help] [-V|--version] [-q|--quiet] [<dir>] [<file>]
- All *.md files under <dir> and subdirectories are checked
- <file> is checked regardless of extension
-q, --quiet: No output means check is OK
-h, --help: This help text
-q, --quiet: No output means check is OK
-V, --version: Output version
-h, --help: This help text
EOC
[[ $1 ]] && echo "$E ERROR:$X $1"
exit 1
@ -128,6 +129,7 @@ self=${0##*/} file='' dir='' line='' flags=0 quiet=0
while (($#))
do
case $1 in
-V|--version) echo "$version"; exit 0 ;;
-h|--help) Help ;;
-q|--quiet) quiet=1; shift ;;
*) if [[ -f $1 ]]