Skip to content

Commit

Permalink
New Feat: show() #4
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalandy committed May 5, 2022
1 parent ab53a17 commit e968537
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 937 deletions.
21 changes: 10 additions & 11 deletions bashlava.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# //
: '
TODO show()
helper function to find avail functions within bashlava.
comment_here
Shows all avail functions within bashlava.
its a way to see all functions at high level
'
# //
: '
Expand Down Expand Up @@ -370,7 +370,7 @@ function ci { # User_
}

function show { # User_
Side_fct #sidecars.sh
Show_Prompt_All # within sidecars.sh
}

function log { # User_
Expand Down Expand Up @@ -404,7 +404,7 @@ function test { # User_
fi

echo
App_array
Utility_Array

# PRINT OPTION 2
echo
Expand Down Expand Up @@ -610,7 +610,7 @@ function Print_Fatal {

### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### #
#
# Conditions: idempotent, due diligence
# Conditions functions
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### #
#
Expand Down Expand Up @@ -720,7 +720,6 @@ function Condition_Apps_Must_Be_Installed {
}

function Core_Check_Which_File_Exist {

# List markdown files under /docs/*
arr=( "welcome_to_bashlava" "help" "test" "debug_upstream" )
for action in "${arr[@]}"; do
Expand All @@ -735,22 +734,22 @@ function Core_Check_Which_File_Exist {

_file_is="LICENSE" _file_path_is="${_path_bashlava}/${_file_is}" && Condition_File_Optionnally_Present
if [[ "${_file_do_not_exist}" == "true" ]]; then
my_message="Dockerfile does not exit, let's generate one" && Print_Warning && sleep 2 && App_init_license && exit 1
my_message="Dockerfile does not exit, let's generate one" && Print_Warning && sleep 2 && Init_license && exit 1
fi

_file_is="README.md" _file_path_is="${_path_bashlava}/${_file_is}" && Condition_File_Optionnally_Present
if [[ "${_file_do_not_exist}" == "true" ]]; then
my_message="Dockerfile does not exit, let's generate one" && Print_Warning && sleep 2 && App_init_readme && exit 1
my_message="Dockerfile does not exit, let's generate one" && Print_Warning && sleep 2 && Init_readme && exit 1
fi

_file_is=".gitignore" _file_path_is="${_path_bashlava}/${_file_is}" && Condition_File_Optionnally_Present
if [[ "${_file_do_not_exist}" == "true" ]]; then
my_message="Dockerfile does not exit, let's generate one" && Print_Warning && sleep 2 && App_init_gitignore && exit 1
my_message="Dockerfile does not exit, let's generate one" && Print_Warning && sleep 2 && Init_gitignore && exit 1
fi

_file_is="Dockerfile" _file_path_is="${_path_bashlava}/${_file_is}" && Condition_File_Optionnally_Present
if [[ "${_file_do_not_exist}" == "true" ]]; then
my_message="Dockerfile does not exit, let's generate one" && Print_Warning && sleep 2 && App_init_dockerfile && exit 1
my_message="Dockerfile does not exit, let's generate one" && Print_Warning && sleep 2 && Init_dockerfile && exit 1
fi

# Warning only
Expand Down Expand Up @@ -836,7 +835,7 @@ function Condition_Dir_Optionnally_Present {

### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### #
#
# Core functions /paths, variables
# Core functions
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### #
#
Expand Down
5 changes: 5 additions & 0 deletions components/example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ function str_not_eq {
echo "The two strings are different"
fi
}

function random_11 { #Side_
openssl rand -hex 3
}

# Refer to 'Condition_File_Must_Be_Present' instead of copy paste this fct
function idempotent_file_exist {
_file_is="somefile.sh"
Expand Down
42 changes: 22 additions & 20 deletions components/sidecars.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

function Side_fct { #Side_
function Show_Prompt_All { #Side_
# when you code a fct, often you dont know by heart condition name
# help advanced
# it also helps me to see all functions at high level
Expand All @@ -13,8 +13,8 @@ function Side_fct { #Side_

read -r month
case ${month} in
1)
echo "0o0o";;
1 | al)
Show_Alias;;
2)
echo "0o0o";;
3)
Expand All @@ -30,10 +30,21 @@ function Side_fct { #Side_
esac
}

function wip { #Side_
#1
function Show_Alias { #Side_
my_message="alias" && Print_Blue && echo
my_message="$(cat ${_path_components}/alias.sh | grep "function " | awk '{print $2}')" && Print_Gray && echo
}

#6
function Show_Sidecars { #Side_
my_message="sidecars" && Print_Blue && echo
my_message="$(cat ${_path_components}/sidecars.sh | grep "{ #Side_" | awk '{print $2}')" && Print_Gray && echo
}

function wip { #Side_
my_message="sidecars" && Print_Blue && echo
my_message="$(cat ${_path_components}/sidecars.sh | grep "{ #Side_" | awk '{print $2}')" && Print_Gray && echo

# code optimization 0o0o CASE per function's category

Expand Down Expand Up @@ -69,20 +80,11 @@ function wip { #Side_
# code optimization 0o0o / Add logic for private script
}

function Show_Sidecars { #Side_
my_message="sidecars" && Print_Blue && echo
my_message="$(cat ${_path_components}/sidecars.sh | grep "{ #Side_" | awk '{print $2}')" && Print_Gray && echo
}

function passgen { #Side_
docker run --rm devmtl/alpine:3.11_2020-02-26_08H42s20_dec5798 sh "random7.sh"
}

function App_random_6 { #Side_
openssl rand -hex 3
}

function App_array { #Side_
function Utility_Array { #Side_
arr=( "Looping ..." "an array of string" )
for i in "${arr[@]}"; do
my_message="${i}" && Print_Gray
Expand Down Expand Up @@ -116,14 +118,14 @@ function App_Curl_url { #Side_
fi
}

function App_init_readme { #Side_
function Init_readme { #Side_
cat << EOF > README_template.md
This README is still empty.
EOF
}

# optional as not everyone needs this option
function App_init_dockerignore { #Side_
function Init_dockerignore { #Side_
cat << EOF > .dockerignore_template
.cache
coverage
Expand All @@ -134,7 +136,7 @@ npm-debug
EOF
}

function App_init_license { #Side_
function Init_license { #Side_
# two things two update here
# project URL
# URL to LICENSE.md (you should fork it)
Expand All @@ -155,7 +157,7 @@ EOF
my_message="File created: ${local_path_bashlava}/LICENSE_template" Print_Green
}

function App_init_dockerfile { #Side_
function Init_dockerfile { #Side_
cat << EOF > Dockerfile_template
###################################
# REQUIRED for bashLaVa https://github.com/firepress-org/bashlava
Expand All @@ -179,7 +181,7 @@ EOF
my_message="File created: ${local_path_bashlava}/Dockerfile_template" Print_Green
}

function App_init_gitignore { #Side_
function Init_gitignore { #Side_
cat <<EOF > .gitignore_template
# Files
############
Expand Down Expand Up @@ -287,5 +289,5 @@ TheVolumeSettingsFolder
.FBCSemaphoreFile
.FBCLockFolder
EOF
my_message="File created: ${local_path_bashlava}/App_init_gitignore" Print_Green
my_message="File created: ${local_path_bashlava}/Init_gitignore" Print_Green
}
Loading

0 comments on commit e968537

Please sign in to comment.