diff --git a/bin/shinclude/help_sys.sh b/bin/shinclude/help_sys.sh index feef89a..fe75780 100755 --- a/bin/shinclude/help_sys.sh +++ b/bin/shinclude/help_sys.sh @@ -98,9 +98,10 @@ init_help_system(){ # Now extract function names for __VENV_FUNCTIONS while IFS= read -r line; do - if [[ "$line" =~ ^[a-zA-Z0-9_]+\(\) ]]; then + if [[ "$line" =~ ^(function[[:space:]]+)?[a-zA-Z_][a-zA-Z0-9_]*\(\)[[:space:]]*\{ ]]; then # Reading function name func="${line%%(*}" + func="${func/#function /}" # Remove 'function ' prefix if exists # Correct the function markdown path local func_markdown_path="${doc_dir}/functions/${func}.md" # Store function name and path to its documentation @@ -143,7 +144,7 @@ create_readme() { description="${description%%\\n*}" # Stop at the first newline # Create a relative path for the markdown link - local markdown_rel_path="${markdown_path/#${__VENV_BASE}docs\//}" + local markdown_rel_path="${markdown_path/#${__VENV_BASE}/}" echo "- [${name}](${markdown_rel_path}): ${description} >> ${readme_path}" echo "- [${name}](${markdown_rel_path}): ${description}" >> "${readme_path}" @@ -227,10 +228,10 @@ generate_markdown(){ fi # Check for beginning of a function - if [[ "$line" =~ ^[a-zA-Z_][a-zA-Z0-9_]*\(\) ]]; then - # Found a function definition + if [[ "$line" =~ ^(function[[:space:]]+)?[a-zA-Z_][a-zA-Z0-9_]*\(\)[[:space:]]*\{ ]]; then # Found a function definition in_function=true current_func_name="${line%%(*}" + current_func_name="${current_func_name/#function /}" # Remove 'function ' prefix if exists function_doc+=("${current_func_name}") function_doc+=("") # Placeholder for the documentation to be appended next continue @@ -260,6 +261,7 @@ generate_markdown(){ for ((i=0; i<${#script_doc[@]}; i+=2)); do if [[ "${script_doc[i]}" == "${__VENV_SCRIPTS[i]}" ]]; then echo "Writing out docs for ${script_doc[i]}" + echo -e "__VENV_BASE: ${__VENV_BASE}" echo -e "${script_doc[i+1]}" > "${__VENV_SCRIPTS[i+1]}" create_readme "${script_doc[i]}" "${script_doc[i+1]}" "${__VENV_SCRIPTS[i+1]}" "${readme_index}" else diff --git a/bin/shinclude/util_funcs.sh b/bin/shinclude/util_funcs.sh index 6727806..f1b6625 100755 --- a/bin/shinclude/util_funcs.sh +++ b/bin/shinclude/util_funcs.sh @@ -277,6 +277,8 @@ stringclean() { echo "${str//[^a-zA-Z0-9]/}" } +function errno() { +# # Function: errno # # Description: This function takes an errno code or errno number and prints the corresponding error message to STDOUT. Sets the exit code to the errno value and returns, unless there is an internal error. @@ -291,7 +293,7 @@ stringclean() { # 2: Could not find system errno.h # 22: Invalid errno name # -function errno() { + # Usage: errno [errno_code|errno_number] if [ -z "$1" ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then echo "Usage: errno [errno_code|errno_number]" @@ -314,9 +316,10 @@ function errno() { local line errno_num errno_text if [[ "$errno_code" =~ ^[0-9]+$ ]]; then - line=$(grep "#define [A-Z_]*[ \t]*$errno_code" "$errno_file") + line=$(grep -wE "#define [A-Z_]*[ \t]*\b$errno_code\b" "$errno_file") + errno_code=$(echo "$line" | awk '{print $2}') else - line=$(grep "#define $errno_code" "$errno_file") + line=$(grep -wE "#define $errno_code[ \t]*" "$errno_file") fi errno_num=$(echo "$line" | awk '{print $3}') diff --git a/docs/shdoc/README.md b/docs/shdoc/README.md index 568f3a6..9e72578 100644 --- a/docs/shdoc/README.md +++ b/docs/shdoc/README.md @@ -1,64 +1,69 @@ # Project Documentation ## Brief introduction of the project. -- [buildvenvs](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/scripts/buildvenvs.md): shellcheck disable=2317,2164 -- [help_sys.sh](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/scripts/help_sys.sh.md): Help System Functions for Bash Scripts -- [init_env.sh](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/scripts/init_env.sh.md): Initialize Environment and Source Utility Scripts -- [purgebld](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/scripts/purgebld.md): -- [runbench](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/scripts/runbench.md): -- [util_funcs.sh](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/scripts/util_funcs.sh.md): Utility Functions for Bash Scripts -- [venv_funcs.sh](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/scripts/venv_funcs.sh.md): Virtual Environment Management Functions for Bash Scripts -- [wrapper_funcs.sh](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/scripts/wrapper_funcs.sh.md): -- [__BLIS](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/functions/__BLIS.md): -- [__CLEANUP](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/functions/__CLEANUP.md): -- [__CMAKE](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/functions/__CMAKE.md): -- [__CONDA](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/functions/__CONDA.md): -- [__CREATE_APP_BASE](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/functions/__CREATE_APP_BASE.md): -- [__OPENBLAS](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/functions/__OPENBLAS.md): -- [__PKG_BUILD](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/functions/__PKG_BUILD.md): -- [__PYTHON_BASE](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/functions/__PYTHON_BASE.md): -- [__set_venv_vars](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/__set_venv_vars.md): -- [__venv_conda_check](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/__venv_conda_check.md): -- [benv](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/benv.md): Create a New Base Virtual Environment -- [cact](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/cact.md): Change active VENV -- [ccln](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/ccln.md): Clone the current VENV and increment the sequence number. -- [create_readme](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/create_readme.md): -- [dact](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/dact.md): Deactivate the current VENV -- [denv](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/denv.md): Delete a Specified Virtual Environment -- [do_wrapper](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/do_wrapper.md): General wrapper function for logging specific command actions -- [general_help](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/general_help.md): Display general help options for the 'help' command. -- [generate_markdown](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/generate_markdown.md): Generate Markdown documentation for all available functions. -- [get_function_hash](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/get_function_hash.md): -- [help_functions](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/help_functions.md): -- [help_scripts](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/help_scripts.md): List sourced scripts and their purpose. -- [init_help_system](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/init_help_system.md): Populate and sort __VENV_FUNCTIONS with function names and documentation from sourced scripts. -- [lastenv](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/lastenv.md): Retrieve the Last Environment with a Given Prefix -- [lenv](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/lenv.md): List All Current VENVs -- [nenv](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/nenv.md): Create a New Virtual Environment in a Series -- [next_step](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/next_step.md): Increment a given sequence number by 1 and pad it with a zero if needed. -- [pact](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/pact.md): Switch to the Previous Active VENV -- [pip](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/pip.md): -- [pop_stack](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/pop_stack.md): Pop a Value from a Named Stack -- [pop_venv](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/pop_venv.md): -- [push_stack](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/push_stack.md): Push a Value onto a Named Stack -- [push_venv](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/push_venv.md): -- [renv](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/renv.md): Revert to Previous Virtual Environment -- [set_args](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/functions/set_args.md): -- [snum](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/snum.md): Force set the VENV Sequence number. -- [sort_2d_array](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/sort_2d_array.md): Sort a Two-Dimensional Array -- [source_util_script](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/source_util_script.md): **Purpose**: -- [specific_function_help](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/specific_function_help.md): Provide detailed documentation for a given function. -- [specific_script_help](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/specific_script_help.md): -- [stack_op](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/stack_op.md): stack_name: The name of the stack. -- [stringclean](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/stringclean.md): str: The string to sanitize. -- [strip_space](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/strip_space.md): Remove Leading and Trailing Whitespaces -- [vdsc](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/vdsc.md): Return the current VENV description. -- [venvdiff](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/venvdiff.md): -- [vhelp](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/vhelp.md): Main entry point for the help system. -- [vnum](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/vnum.md): Return the current VENV sequence number. -- [vpfx](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/vpfx.md): Return the current VENV prefix. -- [write_index_footer](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/write_index_footer.md): -- [write_index_header](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/write_index_header.md): -- [zero_pad](/Users/mps/projects/AI-PROJECTS/venv-build-checker/docs/shdoc/bin/shinclude/functions/zero_pad.md): Pad a Single-Digit Number with a Leading Zero +- [buildvenvs](/docs/shdoc/bin/scripts/buildvenvs.md): shellcheck disable=2317,2164 +- [help_sys.sh](/docs/shdoc/bin/shinclude/scripts/help_sys.sh.md): Help System Functions for Bash Scripts +- [init_env.sh](/docs/shdoc/bin/shinclude/scripts/init_env.sh.md): Initialize Environment and Source Utility Scripts +- [init_env.zsh](/docs/shdoc/bin/shinclude/scripts/init_env.zsh.md): Initialize Environment and Source Utility Scripts +- [purgebld](/docs/shdoc/bin/scripts/purgebld.md): +- [runbench](/docs/shdoc/bin/scripts/runbench.md): +- [util_funcs.sh](/docs/shdoc/bin/shinclude/scripts/util_funcs.sh.md): Utility Functions for Bash Scripts +- [venv_funcs.sh](/docs/shdoc/bin/shinclude/scripts/venv_funcs.sh.md): Virtual Environment Management Functions for Bash Scripts +- [wrapper_funcs.sh](/docs/shdoc/bin/shinclude/scripts/wrapper_funcs.sh.md): +- [__BLIS](/docs/shdoc/bin/functions/__BLIS.md): +- [__CLEANUP](/docs/shdoc/bin/functions/__CLEANUP.md): +- [__CMAKE](/docs/shdoc/bin/functions/__CMAKE.md): +- [__CONDA](/docs/shdoc/bin/functions/__CONDA.md): +- [__CREATE_APP_BASE](/docs/shdoc/bin/functions/__CREATE_APP_BASE.md): +- [__OPENBLAS](/docs/shdoc/bin/functions/__OPENBLAS.md): +- [__PKG_BUILD](/docs/shdoc/bin/functions/__PKG_BUILD.md): +- [__PYTHON_BASE](/docs/shdoc/bin/functions/__PYTHON_BASE.md): +- [__set_venv_vars](/docs/shdoc/bin/shinclude/functions/__set_venv_vars.md): +- [__venv_conda_check](/docs/shdoc/bin/shinclude/functions/__venv_conda_check.md): +- [benv](/docs/shdoc/bin/shinclude/functions/benv.md): Create a New Base Virtual Environment +- [cact](/docs/shdoc/bin/shinclude/functions/cact.md): Change active VENV +- [ccln](/docs/shdoc/bin/shinclude/functions/ccln.md): Clone the current VENV and increment the sequence number. +- [create_readme](/docs/shdoc/bin/shinclude/functions/create_readme.md): +- [dact](/docs/shdoc/bin/shinclude/functions/dact.md): Deactivate the current VENV +- [denv](/docs/shdoc/bin/shinclude/functions/denv.md): Delete a Specified Virtual Environment +- [do_wrapper](/docs/shdoc/bin/shinclude/functions/do_wrapper.md): General wrapper function for logging specific command actions +- [errno](/docs/shdoc/bin/shinclude/functions/errno.md): Function: errno +- [errno_exit](/docs/shdoc/bin/shinclude/functions/errno_exit.md): +- [errno_warn](/docs/shdoc/bin/shinclude/functions/errno_warn.md): +- [general_help](/docs/shdoc/bin/shinclude/functions/general_help.md): Display general help options for the 'help' command. +- [generate_markdown](/docs/shdoc/bin/shinclude/functions/generate_markdown.md): Generate Markdown documentation for all available functions. +- [get_function_hash](/docs/shdoc/bin/shinclude/functions/get_function_hash.md): +- [help_functions](/docs/shdoc/bin/shinclude/functions/help_functions.md): +- [help_scripts](/docs/shdoc/bin/shinclude/functions/help_scripts.md): List sourced scripts and their purpose. +- [init_help_system](/docs/shdoc/bin/shinclude/functions/init_help_system.md): Populate and sort __VENV_FUNCTIONS with function names and documentation from sourced scripts. +- [lastenv](/docs/shdoc/bin/shinclude/functions/lastenv.md): Retrieve the Last Environment with a Given Prefix +- [lenv](/docs/shdoc/bin/shinclude/functions/lenv.md): List All Current VENVs +- [nenv](/docs/shdoc/bin/shinclude/functions/nenv.md): Create a New Virtual Environment in a Series +- [next_step](/docs/shdoc/bin/shinclude/functions/next_step.md): Increment a given sequence number by 1 and pad it with a zero if needed. +- [pact](/docs/shdoc/bin/shinclude/functions/pact.md): Switch to the Previous Active VENV +- [pip](/docs/shdoc/bin/shinclude/functions/pip.md): +- [pop_stack](/docs/shdoc/bin/shinclude/functions/pop_stack.md): Pop a Value from a Named Stack +- [pop_venv](/docs/shdoc/bin/shinclude/functions/pop_venv.md): +- [push_stack](/docs/shdoc/bin/shinclude/functions/push_stack.md): Push a Value onto a Named Stack +- [push_venv](/docs/shdoc/bin/shinclude/functions/push_venv.md): +- [renv](/docs/shdoc/bin/shinclude/functions/renv.md): Revert to Previous Virtual Environment +- [set_args](/docs/shdoc/bin/functions/set_args.md): +- [snum](/docs/shdoc/bin/shinclude/functions/snum.md): Force set the VENV Sequence number. +- [sort_2d_array](/docs/shdoc/bin/shinclude/functions/sort_2d_array.md): Sort a Two-Dimensional Array +- [source_util_script](/docs/shdoc/bin/shinclude/functions/source_util_script.md): **Purpose**: +- [source_util_script](/docs/shdoc/bin/shinclude/functions/source_util_script.md): **Purpose**: +- [specific_function_help](/docs/shdoc/bin/shinclude/functions/specific_function_help.md): Provide detailed documentation for a given function. +- [specific_script_help](/docs/shdoc/bin/shinclude/functions/specific_script_help.md): +- [stack_op](/docs/shdoc/bin/shinclude/functions/stack_op.md): stack_name: The name of the stack. +- [stringclean](/docs/shdoc/bin/shinclude/functions/stringclean.md): str: The string to sanitize. +- [strip_space](/docs/shdoc/bin/shinclude/functions/strip_space.md): Remove Leading and Trailing Whitespaces +- [to_upper](/docs/shdoc/bin/shinclude/functions/to_upper.md): +- [vdsc](/docs/shdoc/bin/shinclude/functions/vdsc.md): Return the current VENV description. +- [vhelp](/docs/shdoc/bin/shinclude/functions/vhelp.md): Main entry point for the help system. +- [vnum](/docs/shdoc/bin/shinclude/functions/vnum.md): Return the current VENV sequence number. +- [vpfx](/docs/shdoc/bin/shinclude/functions/vpfx.md): Return the current VENV prefix. +- [write_index_footer](/docs/shdoc/bin/shinclude/functions/write_index_footer.md): +- [write_index_header](/docs/shdoc/bin/shinclude/functions/write_index_header.md): +- [zero_pad](/docs/shdoc/bin/shinclude/functions/zero_pad.md): Pad a Single-Digit Number with a Leading Zero Footer content -Generated: 2024 02 09 at 07:29:49 +Generated: 2024 04 19 at 02:28:25 diff --git a/docs/shdoc/bin/shinclude/functions/errno.md b/docs/shdoc/bin/shinclude/functions/errno.md new file mode 100644 index 0000000..950ebf8 --- /dev/null +++ b/docs/shdoc/bin/shinclude/functions/errno.md @@ -0,0 +1,9 @@ +Function: errno +Description: This function takes an errno code or errno number and prints the corresponding error message to STDOUT. Sets the exit code to the errno value and returns, unless there is an internal error. +Usage: errno [errno_code|errno_number] +Example: errno EACCES +Returns: "error_code: error_text" +Errors: 2, 22 + 2: Could not find system errno.h + 22: Invalid errno name + diff --git a/docs/shdoc/bin/shinclude/functions/venvdiff.md b/docs/shdoc/bin/shinclude/functions/errno_exit.md similarity index 100% rename from docs/shdoc/bin/shinclude/functions/venvdiff.md rename to docs/shdoc/bin/shinclude/functions/errno_exit.md diff --git a/docs/shdoc/bin/shinclude/functions/errno_warn.md b/docs/shdoc/bin/shinclude/functions/errno_warn.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/docs/shdoc/bin/shinclude/functions/errno_warn.md @@ -0,0 +1 @@ + diff --git a/docs/shdoc/bin/shinclude/functions/source_util_script.md b/docs/shdoc/bin/shinclude/functions/source_util_script.md index 4435f7f..4326f40 100644 --- a/docs/shdoc/bin/shinclude/functions/source_util_script.md +++ b/docs/shdoc/bin/shinclude/functions/source_util_script.md @@ -1,11 +1,11 @@ # Function: source_util_script ## Description - **Purpose**: - - The `source_util_script` function is designed to source a utility script from a specified directory. It's a helper function used within the `init_env.sh` script to modularly load additional scripts as needed. + - The `source_util_script` function is designed to source a utility script from a specified directory. It's a helper function used within the `init_envzsh` script to modularly load additional scripts as needed. - **Usage**: - - This function is called with a single argument: the name of the script to be sourced (without the `.sh` extension). It checks for the presence of the script in the directory specified by `__VENV_INCLUDE` and sources it if found. If the script is not found, it prints an error message and returns with an exit code of 1. + - This function is called with a single argument: the name of the script to be sourced (without the `zsh` extension). It checks for the presence of the script in the directory specified by `__VENV_INCLUDE` and sources it if found. If the script is not found, it prints an error message and returns with an exit code of 1. - **Input Parameters**: - - `script_name`: The name of the script to source (without the `.sh` extension). + - `script_name`: The name of the script to source (without the `zsh` extension). - **Output**: - Sources the specified script if found. Otherwise, outputs an error message. - **Exceptions**: @@ -15,6 +15,6 @@ ```bash # Call within a bash script source_util_script "my_util" - # This attempts to source 'my_util.sh' from the directory specified in __VENV_INCLUDE + # This attempts to source 'my_utilzsh' from the directory specified in __VENV_INCLUDE ``` diff --git a/docs/shdoc/bin/shinclude/functions/to_upper.md b/docs/shdoc/bin/shinclude/functions/to_upper.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/docs/shdoc/bin/shinclude/functions/to_upper.md @@ -0,0 +1 @@ + diff --git a/docs/shdoc/bin/shinclude/scripts/init_env.zsh.md b/docs/shdoc/bin/shinclude/scripts/init_env.zsh.md new file mode 100644 index 0000000..e8730a5 --- /dev/null +++ b/docs/shdoc/bin/shinclude/scripts/init_env.zsh.md @@ -0,0 +1,28 @@ +`init_envzsh` - Initialize Environment and Source Utility Scripts +## Description +- **Purpose**: + - `init_envzsh` is designed to initialize the environment for bash scripting, particularly in the context of managing virtual environments. It sets up the necessary environment and sources utility scripts required for the proper functioning of other scripts in the system. It is responsible for orchestrating the environment setup in the correct order and can also be used to source additional environment or setup scripts as required, such as `.env.local` files. +- **Usage**: + - This script is intended to be sourced in other bash scripts to import the necessary environment and utility functions. It also contains a function that can be called to perform environment setup tasks in user scripts. To use it, include the following line in your bash scripts: + ```zsh + source /path/to/init_env.zsh + ``` +- **Input Parameters**: + - None. The script operates without requiring any input parameters. +- **Output**: + - Upon execution, `init_env.zsh` sets up the environment, sources utility scripts, and prepares the system for managing virtual environments. +- **Exceptions**: + - The script exits with code 1 if it fails to find any of the required scripts or if any part of the initialization process fails. +## Dependencies +- This script relies on utility scripts located in a specified directory (`__VENV_INCLUDE`). It specifically sources the following utility scripts: + - `util_funcs.zsh` + - `help_sys.zsh` + - `venv_funcs.zsh` +- The script also assumes the presence of a Conda environment and attempts to initialize it. +## Examples +- **Sourcing the Script**: + ```zsh + # In your zas script + source /path/to/init_env.xsh +``` +