docs: update
This commit is contained in:
parent
1a3c8638e1
commit
ac5bc01f6a
|
@ -4,16 +4,26 @@
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
<!-- vim-markdown-toc GFM -->
|
<!-- vim-markdown-toc GFM -->
|
||||||
|
|
||||||
* [ShellCheck](#shellcheck)
|
|
||||||
* [Coding Conventions](#coding-conventions)
|
* [Coding Conventions](#coding-conventions)
|
||||||
* [No no's](#no-nos)
|
* [ShellCheck](#shellcheck)
|
||||||
* [If Statements](#if-statements)
|
* [No no's](#no-nos)
|
||||||
* [Case Statements](#case-statements)
|
* [If Statements](#if-statements)
|
||||||
|
* [Case Statements](#case-statements)
|
||||||
|
* [Making changes to Neofetch](#making-changes-to-neofetch)
|
||||||
|
* [Adding support for a new Operating System / Distribution.](#adding-support-for-a-new-operating-system--distribution)
|
||||||
|
|
||||||
<!-- vim-markdown-toc -->
|
<!-- vim-markdown-toc -->
|
||||||
|
|
||||||
|
|
||||||
## ShellCheck
|
## Coding Conventions
|
||||||
|
|
||||||
|
- Indent 4 spaces.
|
||||||
|
- Use [snake_case](https://en.wikipedia.org/wiki/Snake_case) for function
|
||||||
|
and variable names.
|
||||||
|
- Keep lines below `100` characters long.
|
||||||
|
- Use `[[ ]]` for tests.
|
||||||
|
|
||||||
|
### ShellCheck
|
||||||
|
|
||||||
For your contribution to be accepted, your changes need to pass
|
For your contribution to be accepted, your changes need to pass
|
||||||
ShellCheck.
|
ShellCheck.
|
||||||
|
@ -30,16 +40,7 @@ shellcheck neofetch -e SC1090,SC2009,SC2012,SC2016,SC2034,SC2128,SC2153,SC2154,S
|
||||||
request on the repo and our Travis.ci hook will run ShellCheck for you.
|
request on the repo and our Travis.ci hook will run ShellCheck for you.
|
||||||
|
|
||||||
|
|
||||||
## Coding Conventions
|
### No no's
|
||||||
|
|
||||||
- Indent 4 spaces.
|
|
||||||
- Use [snake_case](https://en.wikipedia.org/wiki/Snake_case) for function
|
|
||||||
and variable names.
|
|
||||||
- Keep lines below `100` characters long.
|
|
||||||
- Use `[[ ]]` for tests.
|
|
||||||
|
|
||||||
|
|
||||||
## No no's
|
|
||||||
|
|
||||||
- Don’t use `echo`.
|
- Don’t use `echo`.
|
||||||
- Use `printf "%s\n"`
|
- Use `printf "%s\n"`
|
||||||
|
@ -52,7 +53,7 @@ request on the repo and our Travis.ci hook will run ShellCheck for you.
|
||||||
- Use `awk '/pattern/ { printf }'`
|
- Use `awk '/pattern/ { printf }'`
|
||||||
|
|
||||||
|
|
||||||
## If Statements
|
### If Statements
|
||||||
|
|
||||||
If the test only has one command inside of it; use the compact test
|
If the test only has one command inside of it; use the compact test
|
||||||
syntax. Otherwise the normal `if`/`fi` is just fine.
|
syntax. Otherwise the normal `if`/`fi` is just fine.
|
||||||
|
@ -72,7 +73,7 @@ fi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Case Statements
|
### Case Statements
|
||||||
|
|
||||||
Case statements need to be formatted in a specific way.
|
Case statements need to be formatted in a specific way.
|
||||||
|
|
||||||
|
@ -92,3 +93,55 @@ case "$var" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Making changes to Neofetch
|
||||||
|
|
||||||
|
### Adding support for a new Operating System / Distribution.
|
||||||
|
|
||||||
|
Adding support for a new OS/Distro requires adding the Name, Logo and
|
||||||
|
Colors of the OS/Distro to the `get_distro_ascii()` function.
|
||||||
|
|
||||||
|
The function is located right at the bottom of the script, one function
|
||||||
|
above `main()`. Inside this function you’ll find an alphabetical list of
|
||||||
|
each OS/Distro.
|
||||||
|
|
||||||
|
Find the spot in the list your new OS/Distro fits into and start
|
||||||
|
implementing your changes.
|
||||||
|
|
||||||
|
If your OS/Distro requires changes to the actual information gathering
|
||||||
|
functions then you can make these changes in the `get_*` functions.
|
||||||
|
|
||||||
|
**Syntax**:
|
||||||
|
|
||||||
|
- You have to escape back-slashes (`\`). (eg `\\`)
|
||||||
|
- You can use `${c1}` to `${c6}`to color the ascii.
|
||||||
|
- These are evaluated *after* we read the file.
|
||||||
|
|
||||||
|
|
||||||
|
**Example**:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
"CRUX"*)
|
||||||
|
set_colors 4 5 7 6
|
||||||
|
read -rd '' ascii_data <<'EOF'
|
||||||
|
${c1} odddd
|
||||||
|
oddxkkkxxdoo
|
||||||
|
ddcoddxxxdoool
|
||||||
|
xdclodod olol
|
||||||
|
xoc xdd olol
|
||||||
|
xdc ${c2}k00${c1}Okdlol
|
||||||
|
xxd${c2}kOKKKOkd${c1}ldd
|
||||||
|
xdco${c2}xOkdlo${c1}dldd
|
||||||
|
ddc:cl${c2}lll${c1}oooodo
|
||||||
|
odxxdd${c3}xkO000kx${c1}ooxdo
|
||||||
|
oxdd${c3}x0NMMMMMMWW0od${c1}kkxo
|
||||||
|
oooxd${c3}0WMMMMMMMMMW0o${c1}dxkx
|
||||||
|
docldkXW${c3}MMMMMMMWWN${c1}Odolco
|
||||||
|
xx${c2}dx${c1}kxxOKN${c3}WMMWN${c1}0xdoxo::c
|
||||||
|
${c2}xOkkO${c1}0oo${c3}odOW${c2}WW${c1}XkdodOxc:l
|
||||||
|
${c2}dkkkxkkk${c3}OKX${c2}NNNX0Oxx${c1}xc:cd
|
||||||
|
${c2} odxxdx${c3}xllod${c2}ddooxx${c1}dc:ldo
|
||||||
|
${c2} lodd${c1}dolccc${c2}ccox${c1}xoloo
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
```
|
||||||
|
|
Reference in New Issue