From 29bbf21217f242c462d088c6f24b640e13ebd2c5 Mon Sep 17 00:00:00 2001 From: levasseur Date: Fri, 18 Feb 2022 18:28:33 +0100 Subject: [PATCH] dev.md: updated documentation --- doc/dev.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/doc/dev.md b/doc/dev.md index 0cd31d9..ce555cf 100644 --- a/doc/dev.md +++ b/doc/dev.md @@ -15,8 +15,9 @@ - [4. The diskman.sh file](#4-the-diskmansh-file) - [4.1. Global warning](#41-global-warning) - [4.2. Function](#42-function) - - [4.2.1. ```blank_disk [--full]```](#421-blank_disk-bloc_device---full) - - [4.2.2. ```is_blank ```](#422-is_blank--bloc_device) + - [4.2.1. ```blank_disk [--full]```](#421-blank_disk-bloc_device---full) + - [4.2.2. ```is_blank ```](#422-is_blank--bloc_device) + - [4.2.3. ```mkparts [dos|gpt] [size_part1 [... size_partN]]```](#423-mkparts--disk-dosgpt-size_part1--size_partn) - [4.3. Other functionnalities](#43-other-functionnalities) - [5. The command_line.sh file](#5-the-command_linesh-file) - [5.1. Functions](#51-functions) @@ -76,11 +77,17 @@ - [11.3. Other functionnalities](#113-other-functionnalities) - [12. The utils.sh file](#12-the-utilssh-file) - [12.1. Functions](#121-functions) - - [12.1.1. ```stdtime```](#1211-stdtime) - - [12.1.2. ```function_exists ```](#1212-function_exists-function_name) - - [12.1.3. ```get_mod_name ```](#1213-get_mod_name-module_file) - - [12.1.4. ```set_system_proxy```](#1214-set_system_proxy) - + - [12.1.1. ```stdtime```](#1211-stdtime) + - [12.1.2. ```function_exists ```](#1212-function_exists-function_name) + - [12.1.3. ```get_mod_name ```](#1213-get_mod_name-module_file) + - [12.1.4. ```set_system_proxy```](#1214-set_system_proxy) + - [12.2. Other functionnalities](#122-other-functionnalities) + - [13. The version.sh file](#13-the-versionsh-file) + - [13.1. Functions](#131-functions) + - [13.1.1. ```get_os_version```](#1311-get_os_version) + - [13.1.2. ```set_sys_var ```](#1312-set_sys_var-arch-dist-version-codename) + - [13.2. Other functionnalities](#132-other-functionnalities) + - [14. Writing conventions](#14-writing-conventions) ## 1. Getting started This is a developer's reference. It's not intended to be a manual, but a reference for all internal functions, so you can easily build your own modules. @@ -736,6 +743,41 @@ The ```SYS_CODE``` variable won't be set if your distribution provides no codena ### 13.2. Other functionnalities That file don't provide any other thing that the previously listed functions. +## 14. Writing conventions +For readability and compatibility purpose, I adopted some writing conventions. +First of all indentation is made with space only, as different editors can have +a very different approach on tabs management. Please configure your editor +accordingly if you want to share your work. + +If, for and while statement are all written in that way: +```shell +if [[ condition ]]; then + something +fi +for var in range; do + something +done +while condition; do + something +done +``` +Case statement will look like this: +```shell +case var in + state1) + something + ;; + state2) + something + ;; + *) + something + ;; +esac +``` + +Tests have to be done using if. Writting ```[[ test ]] && action``` is not +encouraged even if elegant. It makes reading harder for beginners. -----------------------------------------------------------------------------