mywiki:linux:linux_soding_style
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| mywiki:linux:linux_soding_style [2014/09/28 07:32] – shaoguoh | mywiki:linux:linux_soding_style [2022/04/02 17:29] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 14: | Line 14: | ||
| indent -kr -i8 -ts8 -sob -l80 -ss -bs -psl < file > | indent -kr -i8 -ts8 -sob -l80 -ss -bs -psl < file > | ||
| - | Note: -l80 will generate different result for two continuous run | + | Note: -l is new as of version 2.1 however and not very intelligent or flexible yet. |
| + | |||
| + | Maybe need to add " | ||
| Line 77: | Line 79: | ||
| | -il1 | | | | -il1 | | | ||
| + | ==== Options' | ||
| + | |||
| + | Here is a list of options alphabetized by long option, to help you find the corresponding short option. | ||
| + | < | ||
| + | --blank-lines-after-commas | ||
| + | --blank-lines-after-declarations | ||
| + | --blank-lines-after-procedures | ||
| + | --blank-lines-before-block-comments | ||
| + | --braces-after-if-line | ||
| + | --braces-after-func-def-line | ||
| + | --brace-indent | ||
| + | --braces-after-struct-decl-line | ||
| + | --braces-on-if-line | ||
| + | --braces-on-func-def-line | ||
| + | --braces-on-struct-decl-line | ||
| + | --break-after-boolean-operator | ||
| + | --break-before-boolean-operator | ||
| + | --break-function-decl-args | ||
| + | --break-function-decl-args-end | ||
| + | --case-indentation | ||
| + | --case-brace-indentation | ||
| + | --comment-delimiters-on-blank-lines | ||
| + | --comment-indentation | ||
| + | --continuation-indentation | ||
| + | --continue-at-parentheses | ||
| + | --cuddle-do-while | ||
| + | --cuddle-else | ||
| + | --declaration-comment-column | ||
| + | --declaration-indentation | ||
| + | --dont-break-function-decl-args | ||
| + | --dont-break-function-decl-args-end | ||
| + | --dont-break-procedure-type | ||
| + | --dont-cuddle-do-while | ||
| + | --dont-cuddle-else | ||
| + | --dont-format-comments | ||
| + | --dont-format-first-column-comments | ||
| + | --dont-line-up-parentheses | ||
| + | --dont-left-justify-declarations | ||
| + | --dont-space-special-semicolon | ||
| + | --dont-star-comments | ||
| + | --else-endif-column | ||
| + | --format-all-comments | ||
| + | --format-first-column-comments | ||
| + | --gnu-style | ||
| + | --honour-newlines | ||
| + | --ignore-newlines | ||
| + | --ignore-profile | ||
| + | --indent-label | ||
| + | --indent-level | ||
| + | --k-and-r-style | ||
| + | --leave-optional-blank-lines | ||
| + | --leave-preprocessor-space | ||
| + | --left-justify-declarations | ||
| + | --line-comments-indentation | ||
| + | --line-length | ||
| + | --linux-style | ||
| + | --no-blank-lines-after-commas | ||
| + | --no-blank-lines-after-declarations | ||
| + | --no-blank-lines-after-procedures | ||
| + | --no-blank-lines-before-block-comments | ||
| + | --no-comment-delimiters-on-blank-lines | ||
| + | --no-space-after-casts | ||
| + | --no-parameter-indentation | ||
| + | --no-space-after-for -nsaf | ||
| + | --no-space-after-function-call-names | ||
| + | --no-space-after-if -nsai | ||
| + | --no-space-after-parentheses | ||
| + | --no-space-after-while -nsaw | ||
| + | --no-tabs | ||
| + | --no-verbosity | ||
| + | --original | ||
| + | --parameter-indentation | ||
| + | --paren-indentation | ||
| + | --preserve-mtime -pmt | ||
| + | --preprocessor-indentation | ||
| + | --procnames-start-lines | ||
| + | --space-after-cast | ||
| + | --space-after-for -saf | ||
| + | --space-after-if -sai | ||
| + | --space-after-parentheses | ||
| + | --space-after-procedure-calls | ||
| + | --space-after-while -saw | ||
| + | --space-special-semicolon | ||
| + | --standard-output | ||
| + | --start-left-side-of-comments | ||
| + | --struct-brace-indentation | ||
| + | --swallow-optional-blank-lines | ||
| + | --tab-size | ||
| + | --use-tabs | ||
| + | --verbose | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Astyle ===== | ||
| + | astyle special usage based on V2.0.4 http:// | ||
| + | |||
| + | Example: | ||
| + | astyle --options=none --align-pointer=name --pad=oper --unpad-paren --pad-paren-out --trim-trailing-whitespace | ||
| + | |||
| + | --options=none | ||
| + | Disable the default options file. Only the command-line | ||
| + | | ||
| + | -p, --pad=oper | ||
| + | Insert space padding around operators | ||
| + | |||
| + | -U, --unpad-paren | ||
| + | Remove space padding around parenthesis on the inside | ||
| + | side. Can be used in combination with the paren padding options. | ||
| + | Only padding that has not been requested by other options | ||
| + | be removed. | ||
| + | |||
| + | -d, --pad-paren-out | ||
| + | Insert space paddings around parenthesies on the outside | ||
| + | This can be used with unpad=paren to remove unwanted spaces. | ||
| + | | ||
| + | With -U -d two options, it will be like if (k > 0), not if( k > 0 ) | ||
| + | |||
| + | -k3, --align-pointer=name | ||
| + | Attach a pointer or reference operator (*, &, or ^) to the variable name (right). | ||
| + | for example: **char* p** becomes **char *p** | ||
| + | |||
| + | ===== Perl/Bash ===== | ||
| + | Use perl to remove trailing whitespace in a string: | ||
| + | $str =~ s/\s+$//; | ||
| + | Take 1 or more white spaces (\s+) till the end of the string ($), and replace them with an empty string. | ||
mywiki/linux/linux_soding_style.1411860776.txt.gz · Last modified: (external edit)
