-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
45 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,10 @@ | |
# Created: Friday, 2022/02/11 - 20:09:07 | ||
# Author.: @fbnmtz, fgm ([email protected]) | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Last Modified: Sunday, 2024/12/08 - 19:21:30 | ||
# Last Modified: Monday, 2024/12/09 - 03:35:32 | ||
# Modified By..: @fbnmtz, ([email protected]) | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Version: 0.2.16.1348 | ||
# Version: 0.2.16.1365 | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Description: | ||
# > | ||
|
@@ -444,9 +444,18 @@ xrun(){ | |
;; | ||
--xhelp) | ||
use utils | ||
local _help_viewer=$(getPath bat less) | ||
local _help_viewer=$(getPath bat less more cat) | ||
shift; xrunHelp | $_help_viewer | ||
;; | ||
--xlib-dirs) | ||
shift; | ||
[ -z "$RED" ] && use colors | ||
echo -e "\n${YELLOW}Listing xSHELL LIB directories:${RESET}\n" | ||
for dir in "${xSHELL_DIRS[@]}"; do | ||
echo -e "${GREEN} \`-> directory '${dir}${RESET})" | ||
done | ||
exit | ||
;; | ||
*) | ||
_PARAMS_+=("$1") | ||
shift | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,10 @@ | |
# Created: Thursday, 2021/05/20 - 13:18:34 | ||
# Author.: @fbnmtz, fgm ([email protected]) | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Last Modified: Sunday, 2024/12/08 - 04:28:46 | ||
# Last Modified: Monday, 2024/12/09 - 13:53:25 | ||
# Modified By..: @fbnmtz, ([email protected]) | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Version: 0.1.18.628 | ||
# Version: 0.1.18.660 | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Description: | ||
# > | ||
|
@@ -21,8 +21,7 @@ | |
# _INIT_DEBUG_=false # set to true or false to DEBUG | ||
|
||
# shellcheck disable=SC1090 #warning on 'source' usage | ||
[ "$_INIT_DEBUG_" == 'true' ] && \ | ||
source "$_xSHELL_/colors" # autoload 'colors' if in DEBUG mode | ||
[ "$_INIT_DEBUG_" == 'true' ] && source "$xSHELL_PATH/colors" # autoload 'colors' if in DEBUG mode | ||
# source /opt/xSHELL/colors # autoload 'colors' if in DEBUG mode | ||
# source ~/bin/xSHELL/colors # autoload 'colors' if in DEBUG mode | ||
|
||
|
@@ -32,6 +31,18 @@ APP=$(basename "$0") # application name | |
APP_DIR=$(dirname "$0") # application current directory | ||
APP_HOME="" # application home (store data) | ||
|
||
xSHELL_DIRS=( | ||
"$APP_DIR/" | ||
"$APP_DIR/lib/" | ||
"$APP_DIR/vendor/" | ||
"$xSHELL_PATH/" | ||
"$xSHELL_PATH/lib/" | ||
"$xSHELL_PATH/vendor/" | ||
# "/opt/xSHELL/" | ||
# "$HOME/bin/xSHELL/" | ||
# "$HOME/bin/xSHELL/vendor/" | ||
# "$HOME/bin/vendor/" | ||
) | ||
|
||
# Função para definir um valor em um array associativo simulado | ||
set_assoc_array() { | ||
|
@@ -66,7 +77,7 @@ _USE_COUNT_=0 | |
# function to set $APP_HOME | ||
# ex: setHome {dir1, dir2} | ||
xsetHome(){ | ||
APP_HOME=~/.fbnmtz/$APP | ||
APP_HOME=~/.xshell/$APP | ||
mkdir -p "$APP_HOME"/"$*" | ||
} | ||
|
||
|
@@ -118,31 +129,23 @@ use(){ | |
if ! checkLibLoaded "$lib_file"; then | ||
|
||
# shellcheck disable=SC2155 # warning - declare and assign separate | ||
local current_path=$(dirname "$0") | ||
local lib_dirs=( | ||
"$current_path/$lib_file" | ||
"$current_path/lib/$lib_file" | ||
"$current_path/vendor/$lib_file" | ||
"$_xSHELL_/$lib_file" | ||
"$_xSHELL_/lib/$lib_file" | ||
"$_xSHELL_/vendor/$lib_file" | ||
# "/opt/xSHELL/$lib_file" | ||
# "$HOME/bin/xSHELL/$lib_file" | ||
# "$HOME/bin/xSHELL/vendor/$lib_file" | ||
# "$HOME/bin/vendor/$lib_file" | ||
) | ||
local current_path=$(dirname "$0") | ||
local included='' | ||
|
||
# search file in default destinations | ||
local li=0 | ||
for lib in "${lib_dirs[@]}"; do | ||
for lib in "${xSHELL_DIRS[@]}"; do | ||
|
||
if source "$lib" 2> /dev/null ; then | ||
_CALLER_=$lib | ||
# success? set a flag; break loop | ||
[ "$_INIT_DEBUG_" == 'true' ] && { | ||
echo -e "${GREEN} \`-> loading '${lib_dirs[$li]}'${RESET} - "\ | ||
"${CYAN}directory: $((li+1))/${#lib_dirs[@]}${RESET})" | ||
# printf " %-${max_length}s %s\n" "$key" "$desc" | ||
|
||
printf " %s\`-> loading '%s' %-25s - directory: %s/%s" "${GREEN}" "${xSHELL_DIRS[$li]}" "${RESET}" "${CYAN}" "$((li+1))" "${#xSHELL_DIRS[@]}${RESET}" | ||
|
||
# echo -e "${GREEN} \`-> loading '${xSHELL_DIRS[$li]}'${RESET} - "\ | ||
# "${CYAN}directory: $((li+1))/${#xSHELL_DIRS[@]}${RESET})" | ||
} | ||
included="true" | ||
|
||
|
@@ -159,10 +162,9 @@ use(){ | |
|
||
# not included with success? raise a error | ||
test -z "$included" && { | ||
echo -e "\n${RED}Error importing lib '$lib_file'"\ | ||
"- NOT_FOUND!${RESET}" | ||
echo -e "\n${RED}Error importing lib '$lib_file' - NOT_FOUND!${RESET}" | ||
[ "$_INIT_DEBUG_" == 'true' ] && { | ||
local all_dirs=${lib_dirs[*]} | ||
local all_dirs=${xSHELL_DIRS[*]} | ||
echo -e "${RED} \`-> searched on dir's:\n *"\ | ||
"${all_dirs// /\\n \* }"\ | ||
"${RESET}" | ||
|
@@ -180,6 +182,7 @@ alias import=use | |
alias require=use | ||
alias load=use | ||
alias unit=use | ||
alias xuse=use | ||
|
||
# validade required binaries | ||
# ex: xrequirements bin1 bin2 bin3A:bin3B | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,10 @@ | |
# Created: Thursday, 2020/02/18 - 20:44:58 | ||
# Author.: @fbnmtz, ([email protected]) | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Last Modified: Monday, 2024/12/09 - 00:55:59 | ||
# Last Modified: Monday, 2024/12/09 - 13:27:32 | ||
# Modified By..: @fbnmtz, ([email protected]) | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Version: 0.1.19.363 | ||
# Version: 0.1.19.375 | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Description: | ||
# > | ||
|
@@ -24,7 +24,7 @@ | |
# -> ignore this warning because shellcheck cant detect variables created by or library system. | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~ | ||
|
||
source "$_xSHELL_/init" | ||
source "$xSHELL_INIT" | ||
|
||
use args utils strings xshell.lib | ||
xrequirements touch chmod date | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,10 @@ | |
# Created: Sunday, 2022/02/20 - 18:44:18 | ||
# Author.: @fbnmtz, ([email protected]) | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Last Modified: Monday, 2024/12/09 - 00:14:48 | ||
# Last Modified: Monday, 2024/12/09 - 04:10:28 | ||
# Modified By..: @fbnmtz, ([email protected]) | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Version: 0.1.13.251 | ||
# Version: 0.1.13.253 | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~ | ||
# Description: | ||
# > | ||
|
@@ -121,7 +121,7 @@ templateScript(){ | |
# -> variables created by or library system (don't worry) | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~ | ||
source \"\$_xSHELL_/init\" | ||
source \"\$xSHELL_INIT\" | ||
use args | ||
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~" | ||
|