docs: Clarify usage of readonly for dynamic variables/functions

This commit is contained in:
fiftydinar 2024-10-01 14:33:48 +02:00 committed by GitHub
parent 58946ae173
commit 15d308b7e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,7 +18,8 @@ These are general guidelines for writing official bash modules and their documen
- Echo what you're doing on each step and on errors to help debugging.
- Implement error-checks for scenarios where the image-maintainer might misconfigure the module.
- Use `snake_case` for functions and variables changed by the code.
- Use `snake_case` for functions and variables changed by the code.
You can utilize `readonly (-f) snake_case` to mark variable or function as read-only when it won't be changed anymore.
- Use `readonly SCREAMING_SNAKE_CASE` for variables that are set once and stay unchanged.
- Use `"${variable_name}"` when you want to expose information from the variable & to ensure that variables are properly parsed as strings.
- If you want to insert another regular string as a suffix or prefix to the `"${variable_name}"`, you should do that in this format: `"prefix-${variable_name}-suffix"`