From 91fc4a046cb0c196ccc4d46e089ce2f01fd082c6 Mon Sep 17 00:00:00 2001 From: Dridi Boukelmoune Date: Mon, 16 Dec 2013 00:01:09 +0100 Subject: [PATCH 1/2] Added a shellcheck(1) man page The manual is mainly a copy/paste from the current documentation. It is builded with pandoc, and written in markdown. closes #50 --- .gitignore | 1 + Makefile | 5 ++- shellcheck.1.md | 91 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 shellcheck.1.md diff --git a/.gitignore b/.gitignore index e7afb85..d9a922b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ .tests jsoncheck shellcheck +shellcheck.1 dist diff --git a/Makefile b/Makefile index fff2feb..562a7d8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ GHCFLAGS=-O9 -all: shellcheck .tests +all: shellcheck .tests shellcheck.1 : Done shellcheck: regardless @@ -13,6 +13,9 @@ shellcheck: regardless : Running unit tests ./test/runQuack && touch .tests +shellcheck.1: shellcheck.1.md + pandoc -s -t man $< -o $@ + clean: rm -f .tests shellcheck *.hi *.o ShellCheck/*.hi ShellCheck/*.o rm -rf dist diff --git a/shellcheck.1.md b/shellcheck.1.md new file mode 100644 index 0000000..a854567 --- /dev/null +++ b/shellcheck.1.md @@ -0,0 +1,91 @@ +% SHELLCHECK(1) Shell script analysis tool + +# NAME + +shellcheck - Shell script analysis tool + +# SYNOPSIS + +**shellcheck** [*OPTIONS*...] *FILES*... + +# DESCRIPTION + +ShellCheck is a static analysis and linting tool for sh/bash scripts. It's +mainly focused on handling typical beginner and intermediate level syntax +errors and pitfalls where the shell just gives a cryptic error message or +strange behavior, but it also reports on a few more advanced issues where +corner cases can cause delayed failures. + +# OPTIONS + +**-f** *FORMAT*, **--format=***FORMAT* + +: Specify the output format of shellcheck, which prints its results in the + standard output. Subsequent **-f** options are ignored, see **FORMATS** + below for more information. + +**-e**\ *CODE1*[,*CODE2*...],\ **--exclude=***CODE1*[,*CODE2*...] + +: Explicitly exclude the specified codes from the report. Subsequent **-e** + options are cumulative, but all the codes can be specified at once, + coma-separated as a single argument. + +# FORMATS + +**tty** + +: This is the default format, a plain text output. If your terminal handles + colors, messages are printed with a different color depending on their + types (error, warnings etc). You get a pretty terminal frontend. + +**gcc** + +: This format outputs messages similar to those from gcc. + + `::: : ` + +**checkstyle** + +: Checkstyle is a development tool to help programmers write Java code that + adheres to a coding standard. Checkstyle reports are XML files that can + be integrated with a wide range of tools from text editors to continuous + integration platforms. + +``` + + + + + ... + + ... + +``` + +**json** + +: Json is a popular serialization format that is more suitable for web + applications. ShellCheck's json is compact and contains only the strict + minimum. + +``` +[ + { + "line": line, + "column": column, + "level": level, + "code": ####, + "message": message + }, + ... +] +``` + +# SEE ALSO + +sh(1) bash(1) From 78d9a7ad97d29cda25fbbb8ffbc042771182aff5 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sun, 15 Dec 2013 19:40:05 -0800 Subject: [PATCH 2/2] Tweaked man page format --- Makefile | 3 +- shellcheck.1.md | 89 ++++++++++++++++++++++++------------------------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index 562a7d8..c915446 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,8 @@ shellcheck.1: shellcheck.1.md pandoc -s -t man $< -o $@ clean: - rm -f .tests shellcheck *.hi *.o ShellCheck/*.hi ShellCheck/*.o + rm -f .tests shellcheck shellcheck.1 + rm -f *.hi *.o ShellCheck/*.hi ShellCheck/*.o rm -rf dist regardless: diff --git a/shellcheck.1.md b/shellcheck.1.md index a854567..49f92f2 100644 --- a/shellcheck.1.md +++ b/shellcheck.1.md @@ -20,71 +20,70 @@ corner cases can cause delayed failures. **-f** *FORMAT*, **--format=***FORMAT* -: Specify the output format of shellcheck, which prints its results in the - standard output. Subsequent **-f** options are ignored, see **FORMATS** - below for more information. +: Specify the output format of shellcheck, which prints its results in the + standard output. Subsequent **-f** options are ignored, see **FORMATS** + below for more information. **-e**\ *CODE1*[,*CODE2*...],\ **--exclude=***CODE1*[,*CODE2*...] -: Explicitly exclude the specified codes from the report. Subsequent **-e** - options are cumulative, but all the codes can be specified at once, - coma-separated as a single argument. +: Explicitly exclude the specified codes from the report. Subsequent **-e** + options are cumulative, but all the codes can be specified at once, + comma-separated as a single argument. + +Also note that shellcheck supports multiple Bourne shell dialects, and +examines the file's shebang to determine which one to use. # FORMATS **tty** -: This is the default format, a plain text output. If your terminal handles - colors, messages are printed with a different color depending on their - types (error, warnings etc). You get a pretty terminal frontend. +: Plain text, human readable output. This is the default. **gcc** -: This format outputs messages similar to those from gcc. +: GCC compatible output. Useful for editors that support compiling and + showing syntax errors. - `::: : ` + For example, in Vim, `:set makeprg=shellcheck\ -f\ gcc\ %` will allow + using `:make` to check the script, and `:cnext` to jump to the next error. + + ::: : **checkstyle** -: Checkstyle is a development tool to help programmers write Java code that - adheres to a coding standard. Checkstyle reports are XML files that can - be integrated with a wide range of tools from text editors to continuous - integration platforms. +: Checkstyle compatible XML output. Supported directly or through plugins + by many IDEs and build monitoring systems. -``` - - - - - ... - - ... - -``` + + + + + ... + + ... + **json** -: Json is a popular serialization format that is more suitable for web - applications. ShellCheck's json is compact and contains only the strict - minimum. +: Json is a popular serialization format that is more suitable for web + applications. ShellCheck's json is compact and contains only the bare + minimum. -``` -[ - { - "line": line, - "column": column, - "level": level, - "code": ####, - "message": message - }, - ... -] -``` + [ + { + "line": line, + "column": column, + "level": level, + "code": ####, + "message": message + }, + ... + ] # SEE ALSO