diff --git a/bashlava.sh b/bashlava.sh index 4d405ee..5fe22d6 100755 --- a/bashlava.sh +++ b/bashlava.sh @@ -22,20 +22,15 @@ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ PRIORITY 1 ____________________________________________________________________________ _______________________________________________________________________________________ -UX: Many optimizations -- Impact on: #4, #8 - -TODO -log() shows a short hash (not the full hash) - TODO -UX: mrg() gh cli, pass attributs -rebase to minimize prompts +UX: many improvements on v(), t(), dummy(), docs/ +- UX: v_and_t() add the option to v() + t() in a single step +- UX: dummy() now writes two commits +- UX: /docs improve prompt syntax +- Impact on: #8 TODO -UX: release() pass attributs to minimize prompts - -WIP -UX: Improve how we manage CONFIGS, vars, sane defaults, idempotent, logic overrides +UX: Improve how we manage CONFIGS, vars, sane defaults, logic overrides - At the moment, its too complex for a new user to configure bashlava - Avoid having multiple place to define them, source components, source .md - Few array that are configs. They should be all together under the same block of code. @@ -54,21 +49,6 @@ Functional impacts: - Impact on: #4, #8, #10 - - -TODO -optimize my_message when calling - Print_ - Banner_ - -Instead of creating custom var simnply use %1 %2 <=dollar sign - - function greet () { - echo "Hello @1" - } - greet "Shellman" - - TODO private scripts logical flags to manage under /private/* Need to check if files exist /private/* when DIR private exist @@ -80,6 +60,7 @@ overide like: - custom_fct_help="false" - set a new config flag: debug="true" + TODO ## App if app are installed which git-crypt @@ -97,6 +78,19 @@ TODO fi +TODO +optimize my_message when calling + Print_ + Banner_ + +Instead of creating custom var simnply use %1 %2 <=dollar sign + + function greet () { + echo "Hello @1" + } + greet "Pascal" + + TODO ci pipeline - superlinter (includes shellcheck) - create ci for using shellcheck @@ -307,8 +301,10 @@ function mrg { # User_ case ${user_input} in 1 | v) version;; 2 | t) tag;; - 3 | ci) ci;; - 4 | e) edge;; + 3 | e) edge;; + 4 | ci) ci;; + 8 | vt) v_and_t;; + 9 | a) echo "WIP, will allow the user to: v + t + r + e in one step";; *) my_message="Aborted" && Print_Gray;; esac } @@ -369,7 +365,7 @@ function version { # User_ function tag { # User_ Condition_No_Commits_Pending - Condition_Attr_2_Must_Be_Empty + #Condition_Attr_2_Must_Be_Empty _from_fct="t" git tag ${app_version} && git push --tags && echo @@ -386,6 +382,56 @@ function tag { # User_ esac } +function v_and_t { + # version and tag +# TODO + # I can optimze this later with a flag + # I need to duplicate v() code because we prompt in version and in tag +### The version is stored within the Dockerfile. For BashLaVa, this Dockerfile is just a config-env file + Condition_No_Commits_Pending + _from_fct="v" + + Show_Version + + # set input_2 if not provided + if [[ "${input_2}" == "not_set" ]]; then + my_message="What is the version number (ex: 1.12.4.)?" && Print_Green + read -r user_input; + echo; + my_message="${user_input}" && Print_Green + input_2="${user_input}" + Condition_Version_Must_Be_Valid + + elif [[ "${input_2}" != "not_set" ]]; then + echo "Good, lets continue" > /dev/null 2>&1 + else + my_message="FATAL: (version)" && Print_Fatal + fi + + + if [[ "${input_2}" != "not_set" ]]; then + + Condition_Attr_2_Must_Be_Provided + Condition_Version_Must_Be_Valid + + ### Update version within Dockerfile + sed -i '' "s/^ARG VERSION=.*$/ARG VERSION=\"${input_2}\"/" Dockerfile + # code optimization 0o0o, Add logic for /private scripts + + git add . + git commit . -m "Update ${app_name} to version ${input_2}" + git push && echo + Show_Version + Show_What_Was_Done + tag + + elif [[ "${input_2}" == "not_set" ]]; then + my_message="ERROR: This should not happen (version)" && Print_Warning_Stop + else + my_message="FATAL (version)" && Print_Fatal + fi +} + function tci { # User_ Condition_No_Commits_Pending Condition_Attr_2_Must_Be_Empty @@ -486,13 +532,19 @@ function dummy { # User_ Condition_Attr_2_Must_Be_Empty Condition_No_Commits_Pending _from_fct="d" - _in_file="README.md" - _hash=$(echo ${date_nano} | sha256sum | awk '{print $1}') - _hash_four_last="${_hash: -4}" - echo "Dummy Commit, ${date_sec}, ${_hash}" >> "${_in_file}" - git add -A && git commit -m "dummy commit ${_hash_four_last}" && git push + # create a commit X time the update + for lineID in $(seq 1 2); do + date_nano="$(date +%Y-%m-%d_%HH%Ms%S-%N)" + _hash=$(echo ${date_nano} | sha256sum | awk '{print $1}') + _hash_four_last="${_hash: -4}" + echo "Dummy Commit, ${date_sec}, ${_hash}" >> "${_in_file}" + git add -A && git commit -m "dummy commit ${_hash_four_last}" + sleep 1 + done + + git push log } diff --git a/docs/next_move_fct_ci.md b/docs/next_move_fct_ci.md index 6bad1fe..3e3539e 100755 --- a/docs/next_move_fct_ci.md +++ b/docs/next_move_fct_ci.md @@ -1,4 +1,4 @@ -🚀 Do you want to `mrg`? +🚀 What do you want to do next? -- `1` ... |`y`,`mrg` -- `2` ... |`n` +- `1` ... |`mrg` +- `q` ... | quit diff --git a/docs/next_move_fct_mrg.md b/docs/next_move_fct_mrg.md index 6b42edb..1464235 100755 --- a/docs/next_move_fct_mrg.md +++ b/docs/next_move_fct_mrg.md @@ -2,6 +2,8 @@ - `1` ... |`v` - `2` ... |`t` -- `3` ... |`ci` -- `4` ... |`e` -- `5` ... |`q`uit +- `3` ... |`e` +- `4` ... |`ci` +- `8` ... |`vt` (combined) +- `9` ... |`a` (WIP will allow the user to: v + t + r + e in one step) +- `q` ... | quit diff --git a/docs/next_move_fct_pr.md b/docs/next_move_fct_pr.md index 06eb23a..73b6436 100755 --- a/docs/next_move_fct_pr.md +++ b/docs/next_move_fct_pr.md @@ -2,4 +2,4 @@ - `1` ... |`mrg` - `2` ... |`ci` -- `3` ... |`q`uit +- `q` ... | quit diff --git a/docs/next_move_fct_release.md b/docs/next_move_fct_release.md index a626890..1fc3bbf 100755 --- a/docs/next_move_fct_release.md +++ b/docs/next_move_fct_release.md @@ -1,4 +1,4 @@ 🚀 What do you want to do next? - `1` ... |`e` -- `2` ... |`q`uit +- `q` ... | quit diff --git a/docs/next_move_fct_tag.md b/docs/next_move_fct_tag.md index 4083708..257ac32 100755 --- a/docs/next_move_fct_tag.md +++ b/docs/next_move_fct_tag.md @@ -2,4 +2,4 @@ - `1` ... |`r` - `2` ... |`ci` -- `3` ... |`q`uit +- `q` ... | quit diff --git a/docs/next_move_fct_tci.md b/docs/next_move_fct_tci.md index 4083708..257ac32 100755 --- a/docs/next_move_fct_tci.md +++ b/docs/next_move_fct_tci.md @@ -2,4 +2,4 @@ - `1` ... |`r` - `2` ... |`ci` -- `3` ... |`q`uit +- `q` ... | quit diff --git a/docs/next_move_fct_v.md b/docs/next_move_fct_v.md index b082e15..a37351a 100755 --- a/docs/next_move_fct_v.md +++ b/docs/next_move_fct_v.md @@ -2,4 +2,4 @@ - `1` ... |`t` - `2` ... |`pr` -- `3` ... |`q`uit +- `q` ... | quit diff --git a/docs/prompt_fct_v_confirmation.md b/docs/prompt_fct_v_confirmation.md index 8d25a42..422f211 100755 --- a/docs/prompt_fct_v_confirmation.md +++ b/docs/prompt_fct_v_confirmation.md @@ -2,4 +2,4 @@ Is version is valid? - `1` ... |`y` - `2` ... |`n`, I want to **fix it** -- `3` ... |`q`uit +- `q` ... | quit diff --git a/docs/prompt_show_fct.md b/docs/prompt_show_fct.md index 42793ef..bce3e1b 100755 --- a/docs/prompt_show_fct.md +++ b/docs/prompt_show_fct.md @@ -9,7 +9,7 @@ Show functions by categories: - `7`,`user` ... | User facing - `8`,`util` ... | Utilities - `9`,`a` ...... | All -- `0`,`q` ...... | quit +- `q` .......... | quit Show files: diff --git a/docs/welcome_to_bashlava.md b/docs/welcome_to_bashlava.md index 813c144..70c7677 100755 --- a/docs/welcome_to_bashlava.md +++ b/docs/welcome_to_bashlava.md @@ -8,6 +8,6 @@ - `1` ... |`h`,`help` - `2` ... |`tt`,`test` -- `3` ... |`q`uit,`a`bord +- `q` ... | quit Tip 💡: You can execute these commands directly: `bashlava h`,`bashlava test`, etc.