Skip to content

Commit

Permalink
feat: add modules shellcheck, gitleaks, add scripts to git (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
serdigital64 authored Jan 18, 2025
1 parent bcdbece commit cbb8a94
Show file tree
Hide file tree
Showing 105 changed files with 1,326 additions and 2,237 deletions.
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,43 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0]

### Added

- Modules
- ShellCheck
- GitLeaks
- Linux
- linux-package-list
- Git
- git-commit-undo-last
- git-repo-backup-create
- git-repo-optimize
- git-config-show

### Fixed

- LinuxDistro
- linux-distro-upgrade: missing cmd check

### Changed

- GitHub
- github-repo-show
- github-repo-branch-list
- PostgreSQL
- **breaking-change** scripts renamed:
- psql-index-info
- pgsql-index-describe
- pgsql-index-list-all
- pgsql-index-list-creating
- psql-query-info
- pgsql-query-show-active
- psql-table-info
- pgsql-table-describe
- pgsql-table-list

## [0.18.0]

### Added
Expand Down
19 changes: 7 additions & 12 deletions docs/skeletons/module-lib-base/module-lib
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
#!/usr/bin/env bash
# template-module-base: 2.0.0
# template-module-base: 2.2.0
#######################################
# X_MODULE_NAME_X / Lib
#
# Version: 1.0.0
#
#######################################
# Copyright [2024] [[email protected]]
# Copyright SerDigital64 - https://github.com/serdigital64
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -25,14 +17,17 @@
# Imports
#

# X_IMPORTS_PLACEHOLDER_X
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" ||
{ echo 'Error: unable to load bashlib64' && exit 1; }

#
# Globals
#

# shellcheck disable=SC2034
{
declare S64_X_MODULE_CAPS_X_VERSION='1.0.0'
# X_GLOBALS_PLACEHOLDER_X
}

Expand Down
32 changes: 16 additions & 16 deletions docs/skeletons/module-lib/module-lib
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
#!/usr/bin/env bash
# template-module-lib: 2.0.0
# template-module-base: 2.0.0
# template-module-lib: 2.2.0
# template-module-base: 2.2.0
# template-module-setup: 2.0.0
# template-module-cli: 1.1.0
# template-module-vars: 1.0.0
#######################################
# X_MODULE_NAME_X / Lib
#
# Version: 1.0.0
#
#######################################
# Copyright [2024] [[email protected]]
# Copyright SerDigital64 - https://github.com/serdigital64
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -30,7 +22,11 @@
#

# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" ||
source "${S64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-fmt.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-xsv.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-txt.bash" &&
source "${S64_CORE_PATH_BL64}/bashlib64-module-fs.bash" ||
{ echo 'Error: unable to load bashlib64' && exit 1; }

#
Expand All @@ -39,7 +35,9 @@ source "${S64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" ||

# shellcheck disable=SC2034
{
declare S64_X_MODULE_CAPS_X_PATH_CLI="${S64_X_MODULE_CAPS_X_PATH_CLI:-X_MODULE_PATH_CLI_X}"
declare S64_X_MODULE_CAPS_X_VERSION='1.0.0'
declare S64_X_MODULE_CAPS_X_PATH_CLI="${S64_X_MODULE_CAPS_X_PATH_CLI:-}"
# X_GLOBALS_PLACEHOLDER_X
}

#
Expand All @@ -49,13 +47,13 @@ source "${S64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" ||
function s64_X_MODULE_X_lib_setup() {
bl64_dbg_app_show_function
if [[ -z "$S64_X_MODULE_CAPS_X_PATH_CLI" ]]; then
S64_X_MODULE_CAPS_X_PATH_CLI="$(bl64_bsh_command_locate 'argocd')"
S64_X_MODULE_CAPS_X_PATH_CLI="$(bl64_bsh_command_locate 'X_CLI_COMMAND_X')"
else
bl64_check_command "$S64_X_MODULE_CAPS_X_PATH_CLI"
fi
}

function s64_X_MODULE_X_lib_run_X_MODULE_CLI_NAME_X() {
function s64_X_MODULE_X_lib_run_X_CLI_COMMAND_X() {
bl64_dbg_app_show_function "$@"
local verbose_flag='--verbose'
bl64_msg_app_verbose_enabled || verbose_flag=' '
Expand All @@ -66,3 +64,5 @@ function s64_X_MODULE_X_lib_run_X_MODULE_CLI_NAME_X() {
"$@"
bl64_dbg_app_trace_stop
}

# X_FUNCTIONS_PLACEHOLDER_X
37 changes: 12 additions & 25 deletions docs/skeletons/one-liner-base/module-task
Original file line number Diff line number Diff line change
@@ -1,44 +1,31 @@
#!/usr/bin/env bash
# template-one-base: 1.0.0
# template-one-base: 2.0.0
# template-import: 2.0.1
#######################################
# X_MODULE_NAME_X / [X_SUBMODULE_NAME_X /] X_APP_NAME_X
#
# Version: 1.0.0
#
#######################################
# Copyright [2024] [[email protected]]
# Copyright SerDigital64 - https://github.com/serdigital64
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#######################################

#
# Imports
#

# X_IMPORTS_PLACEHOLDER_X
declare S64_CORE_PATH_ROOT="${S64_CORE_PATH_ROOT:-/opt/sysop64}"
# shellcheck source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/core/core-lib" && source "${S64_CORE_PATH_ROOT}/core/X_MODULE_X-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" || { echo 'Error: unable to load bashlib64' && exit 1; }

#
# Functions
#
# X_GLOBALS_PLACEHOLDER_X

# X_FUNCTIONS_PLACEHOLDER_X

#
# Main
#

declare command='X_COMMAND_X'

# X_MAIN_PLACEHOLDER_X
bl64_lib_script_version_set '1.0.0'
bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" && initialize || exit $?
bl64_msg_show_batch_start "$BL64_SCRIPT_ID"
# X_COMMAND_PLACEHOLDER_X
Expand Down
32 changes: 8 additions & 24 deletions docs/skeletons/one-liner/module-task
Original file line number Diff line number Diff line change
@@ -1,53 +1,37 @@
#!/usr/bin/env bash
# template-one: 2.0.0
# template-one-base: 1.0.0
# template-import: 2.0.0
# template-one: 3.0.0
# template-one-base: 2.0.0
#######################################
# X_MODULE_NAME_X / [X_SUBMODULE_NAME_X /] X_APP_NAME_X
#
# Version: 1.0.0
#
#######################################
# Copyright [2024] [[email protected]]
# Copyright SerDigital64 - https://github.com/serdigital64
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#######################################

#
# Imports
#

declare S64_CORE_PATH_ROOT="${S64_CORE_PATH_ROOT:-/opt/sysop64}"
# shellcheck source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/core/core-lib" && source "${S64_CORE_PATH_ROOT}/core/X_MODULE_X-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" || { echo 'Error: unable to load bashlib64' && exit 1; }

#
# Functions
#
# X_FUNCTIONS_PLACEHOLDER_X

function initialize() {
bl64_dbg_app_show_function
s64_X_MODULE_X_lib_setup || return $?
# X_INIT_PLACEHOLDER_X
}

#
# Main
#

# X_MAIN_PLACEHOLDER_X
bl64_lib_script_version_set '1.0.0'
bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" && initialize || exit $?
bl64_msg_show_batch_start "$BL64_SCRIPT_ID"
s64_X_MODULE_X_lib_run_X_MODULE_CLI_NAME_X \
# X_COMMAND_PLACEHOLDER_X
bl64_msg_show_batch_finish $? "$BL64_SCRIPT_ID"
56 changes: 24 additions & 32 deletions docs/skeletons/task-generic-base/module-task
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
#!/usr/bin/env bash
# template-task-base: 1.1.0
# template-task-base: 2.0.0
# template-import: 2.0.1
#######################################
# X_MODULE_NAME_X / [X_SUBMODULE_NAME_X /] X_APP_NAME_X
#
# Version: 1.0.0
#
#######################################
# Copyright [2024] [[email protected]]
# Copyright SerDigital64 - https://github.com/serdigital64
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -25,6 +18,12 @@
# Imports
#

declare S64_CORE_PATH_ROOT="${S64_CORE_PATH_ROOT:-/opt/sysop64}"
# shellcheck source-path=SCRIPTDIR/..
source "${S64_CORE_PATH_ROOT}/core/core-lib" && source "${S64_CORE_PATH_ROOT}/core/X_MODULE_X-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${S64_CORE_PATH_BL64}/bashlib64-core.bash" || { echo 'Error: unable to load bashlib64' && exit 1; }

#
# Globals
#
Expand All @@ -42,25 +41,9 @@ function X_COMMAND_X() {

function initialize() {
bl64_dbg_app_show_function
bl64_check_parameter 'COMMAND' ||
{ help && return 1; }

bl64_check_parameter 'COMMAND' || { help && return 1; }
s64_X_MODULE_X_lib_setup
# X_INIT_PLACEHOLDER_X
return 0
}

function help() {
bl64_msg_show_usage \
'-x [-V Verbose] [-D Debug] [-h]' \
'X_MODULE_NAME_X / [X_SUBMODULE_NAME_X /] X_APP_NAME_X' \
'
-x : X_COMMAND_INFO_X
' '
-h : Show help
' '
-V Verbose : Set verbosity level. Format: one of BL64_MSG_VERBOSE_*
-D Debug : Enable debugging mode. Format: one of BL64_DBG_TARGET_*
'
}

#
Expand All @@ -70,14 +53,23 @@ function help() {
declare COMMAND="$BL64_VAR_NULL"
declare OPTION=''

(($# == 0)) && help && exit 1
bl64_lib_script_version_set '1.0.0'
bl64_msg_help_usage_set 'X_HELP_CLI_X [-V Verbose] [-D Debug] [-h]'
bl64_msg_help_about_set 'X_HELP_ABOUT_X'
# shellcheck disable=SC2016
bl64_msg_help_parameters_set \
'X_HELP_PARAMETERS_X
-V Verbose : Set verbosity level. Format: one of BL64_MSG_VERBOSE_*
-D Debug : Enable debugging mode. Format: one of BL64_DBG_TARGET_*'

(($# == 0)) && bl64_msg_help_show && exit 1
while getopts ':xV:D:h' OPTION; do
case "$OPTION" in
x) COMMAND='X_COMMAND_X' ;;
V) S64_CORE_SET_VERBOSE="$OPTARG" ;;
D) S64_CORE_SET_DEBUG="$OPTARG" ;;
h) help && exit 0 ;;
*) help && exit 1 ;;
h) bl64_msg_help_show && exit 0 ;;
*) bl64_msg_help_show && exit 1 ;;
esac
done
bl64_dbg_set_level "$S64_CORE_SET_DEBUG" && bl64_msg_set_level "$S64_CORE_SET_VERBOSE" && initialize || exit $?
Expand Down
Loading

0 comments on commit cbb8a94

Please sign in to comment.