This document, stolen from the Neofetch repository, describes the code style required when contributing to Winfetch.
- No using PowerShell aliases. Please.
- Use .NET functions where possible.
- exception:
write-host
instead ofconsole.writeline()
- exception:
- Don't throw exceptions.
- Intead, write the error message in
red
and terminate (exit 1
).
- Intead, write the error message in
- Indent 4 spaces.
- Use snake_case for function and variable names.
- Try to keep lines below
128
characters long. - Use lowercase for .NET functions where possible.
- e.g.
[text.encoding]::utf8.getstring((000,000,000))
instead of[Text.Encoding]::UTF8.GetString((000,000,000))
.
- e.g.
Also, please test out your changes before submitting a PR.
Do not put the else/elseif
clause on a separate line:
if ($condition) {
}
else {} # BAD
if ($condition) {
} else {
} # GOOD
if ($condition) {}
else {} # THIS IS OK