Cerulean-Circle-GmbH / once.sh

Unified shell environment for UCP components and ONCE the Object Network Communication Environment
GNU General Public License v3.0
3 stars 3 forks source link

Include code style for bash scripts to compare changes with ease #12

Open chrda81 opened 2 weeks ago

chrda81 commented 2 weeks ago

I would prefere to include this .editorconfig file for using this with a VSCode plugin during file format/save operations:

root = true

[*]
# like -i=2
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
curly_bracket_next_line = false
spaces_around_operators = true
spaces_around_brackets = inside
insert_final_newline = true
end_of_line = lf

# --language-variant
shell_variant      = bash
binary_next_line   = true
# --case-indent
switch_case_indent = true
space_redirects    = true
keep_padding       = false
# --func-next-line
function_next_line = false

# Ignore the entire "docs" directory when calling shfmt on directories,
# such as "shfmt -l -w .". When formatting files directly,
# like "shfmt -w docs/foo.sh" or "shfmt --filename=docs/foo.sh",
# the ignore logic is applied only when the --apply-ignore flag is given.
[docs/**]
ignore = true
chrda81 commented 2 weeks ago

The branch https://github.com/chrda81/once.sh/tree/fix/code-styling is the starting point for this hugh rework and is put on top of PR #11.

The formatter shfmt reorganizes with the .editorconfig rules the curly brackets for function declarations and needs to be modified to show the full description as before: image

For the tab completion, this should already work with the below modification: image

chrda81 commented 2 weeks ago

Add "# <<EOD" for marking end of block comments for documentation

image

chrda81 commented 1 week ago

The main rework is done and could be merged after PR fix/dev or as standalone PR (because it is based on fix/dev). The new PR #14 is created for that purpose