sequencer - correct indentation using .editorconfig

This commit is contained in:
2022-03-14 21:31:53 +01:00
parent 71612aef94
commit 992868b14d

View File

@@ -89,7 +89,7 @@ Usage: $SEQ_NAME [OPTIONS] [STEP NUMBER(s) or ALIAS] [STEP ARGUMENTS]
--version : Display version of sequencer and revision of sequence --version : Display version of sequencer and revision of sequence
-- : End options marker -- : End options marker
++ : Quick start step 1 (-qq) and skipping [STEP NUMBER(s) or ALIAS] ++ : Quick start step 1 (-qq) and skipping [STEP NUMBER(s) or ALIAS]
[STEP NUMBER"(s)" 1-${MAX_STEP} or ALIAS] [STEP NUMBER"(s)" 1-${MAX_STEP} or ALIAS]
No STEP or ALIAS : assume 1 as starting point No STEP or ALIAS : assume 1 as starting point
Single STEP or ALIAS : starting point of sequential process Single STEP or ALIAS : starting point of sequential process
@@ -144,15 +144,15 @@ sequencer.sh global variables:
sequencer.sh build-in functions: sequencer.sh build-in functions:
USAGE_API USAGE_API
echo -e "${GREEN} exe [COMMANDLINE]${NC}" echo -e "${GREEN} exe [COMMANDLINE]${NC}"
cat <<USAGE_API cat <<USAGE_API
Execute command line without pipes or redirects (>,<,|). Execute command line without pipes or redirects (>,<,|).
Supporting: dry-run (-d): only print command without execution Supporting: dry-run (-d): only print command without execution
verbose (-v): print command before execution verbose (-v): print command before execution
USAGE_API USAGE_API
echo -e "${GREEN} exep \"[COMMAND STRING(s)]\"${NC}" echo -e "${GREEN} exep \"[COMMAND STRING(s)]\"${NC}"
cat <<USAGE_API cat <<USAGE_API
See exe, but support for pipes or redirects. See exe, but support for pipes or redirects.
e.g.: exep echo hello world \\> \\'out put.log\\' e.g.: exep echo hello world \\> \\'out put.log\\'
exep echo hello world \\> out\\\\ put.log exep echo hello world \\> out\\\\ put.log
@@ -163,14 +163,14 @@ cat <<USAGE_API
- All apostrophes need to be esacped since the command line is given as string. - All apostrophes need to be esacped since the command line is given as string.
USAGE_API USAGE_API
echo -e "${GREEN} escpath <PATH>${NC}" echo -e "${GREEN} escpath <PATH>${NC}"
cat <<USAGE_API cat <<USAGE_API
Escaping non-printable characters with the proposed POSIX $'' syntax Escaping non-printable characters with the proposed POSIX $'' syntax
e.g. \$(escpath /my own/ho me/path) = $(escpath /my own/ho me/path) e.g. \$(escpath /my own/ho me/path) = $(escpath /my own/ho me/path)
USAGE_API USAGE_API
echo -e "${GREEN} initSeqConfig [OPTION] <NAME> [TEMPLATE]${NC}" echo -e "${GREEN} initSeqConfig [OPTION] <NAME> [TEMPLATE]${NC}"
cat <<USAGE_API cat <<USAGE_API
Create a configuration file in $SEQ_CONFIG_HOME/ and source it if already existent. Create a configuration file in $SEQ_CONFIG_HOME/ and source it if already existent.
[OPTION] [OPTION]
-p : Use profiles -p : Use profiles
@@ -184,8 +184,8 @@ cat <<USAGE_API
3 : No configuration created 3 : No configuration created
USAGE_API USAGE_API
echo -e "${GREEN} addConf <OPTIONS> [SOURCE TYPE] <SOURCE> <DESTINATION FILE>${NC}" echo -e "${GREEN} addConf <OPTIONS> [SOURCE TYPE] <SOURCE> <DESTINATION FILE>${NC}"
cat <<USAGE_API cat <<USAGE_API
Trying to write or append text or a file (<SOURCE>) to a destination file. Trying to write or append text or a file (<SOURCE>) to a destination file.
If the CONFIGFILE exists, a backup (name_%Y%m%d-%H%M%S.bck) is saved at the same location. If the CONFIGFILE exists, a backup (name_%Y%m%d-%H%M%S.bck) is saved at the same location.
If -s fails or -m, "$(realpath "$MISSING_CONF")" is created with the conflicts If -s fails or -m, "$(realpath "$MISSING_CONF")" is created with the conflicts
@@ -203,65 +203,65 @@ cat <<USAGE_API
Target file to be created or modified. Target file to be created or modified.
USAGE_API USAGE_API
echo -e "${GREEN} step <STEP NUMBER OR ALIAS>${NC}" echo -e "${GREEN} step <STEP NUMBER OR ALIAS>${NC}"
cat <<USAGE_API cat <<USAGE_API
Executes a single step also by alias. Useful if step numbers get reorganized. Executes a single step also by alias. Useful if step numbers get reorganized.
dry-run is not applied in this function! The executed step is responsible. dry-run is not applied in this function! The executed step is responsible.
USAGE_API USAGE_API
echo -e "${GREEN} outColor [FOREGROUND COLOR] [BACKGROUND COLOR]${NC}" echo -e "${GREEN} outColor [FOREGROUND COLOR] [BACKGROUND COLOR]${NC}"
cat <<USAGE_API cat <<USAGE_API
Set output color permanently until reset. Set output color permanently until reset.
No argument or unknown foreground color restores shell default (reset). No argument or unknown foreground color restores shell default (reset).
Color reset happens after every step and step_info function call. Color reset happens after every step and step_info function call.
[COLOR]: black, red, green, yellow, blue, magenta, cyan, white [COLOR]: black, red, green, yellow, blue, magenta, cyan, white
USAGE_API USAGE_API
echo -e "${GREEN} echoerr [...]${NC}" echo -e "${GREEN} echoerr [...]${NC}"
cat <<USAGE_API cat <<USAGE_API
echo to stderr echo to stderr
[...] : all parameter are forwarded to echo [...] : all parameter are forwarded to echo
USAGE_API USAGE_API
echo -e "${GREEN} echoseq [...]${NC}" echo -e "${GREEN} echoseq [...]${NC}"
cat <<USAGE_API cat <<USAGE_API
echo to stdout if sequencer output is not suppressed echo to stdout if sequencer output is not suppressed
[...] : all parameter are forwarded to echo [...] : all parameter are forwarded to echo
USAGE_API USAGE_API
echo -e "${GREEN} echoinfo [...]${NC}" echo -e "${GREEN} echoinfo [...]${NC}"
cat <<USAGE_API cat <<USAGE_API
echo additional correctly indented line to step info echo additional correctly indented line to step info
[...] : all parameter are forwared to echo [...] : all parameter are forwared to echo
USAGE_API USAGE_API
echo -e "${GREEN} echoinfoArgs [...]${NC}" echo -e "${GREEN} echoinfoArgs [...]${NC}"
cat <<USAGE_API cat <<USAGE_API
echo argument description after step number or alias. echo argument description after step number or alias.
This must be called first in the step info function. This must be called first in the step info function.
Does not add a newline at the end. Does not add a newline at the end.
[...] : no parameter are forwared to echo [...] : no parameter are forwared to echo
USAGE_API USAGE_API
echo -e "${GREEN} endCheckEmpty <VARIABLENAME> [DESCRIPTION]${NC}" echo -e "${GREEN} endCheckEmpty <VARIABLENAME> [DESCRIPTION]${NC}"
cat <<USAGE_API cat <<USAGE_API
exit 666 if variable is empty exit 666 if variable is empty
<VARIABLENAME> : Name used within eval <VARIABLENAME> : Name used within eval
[DESCRIPTION] : Additional text for error output [DESCRIPTION] : Additional text for error output
USAGE_API USAGE_API
echo -e "${GREEN} saveReturn [ERRORCODE]${NC}" echo -e "${GREEN} saveReturn [ERRORCODE]${NC}"
cat <<USAGE_API cat <<USAGE_API
Save ERRORCODE if it is != 0 for later use with endReturn Save ERRORCODE if it is != 0 for later use with endReturn
USAGE_API USAGE_API
echo -e "${GREEN} getReturn${NC}" echo -e "${GREEN} getReturn${NC}"
cat <<USAGE_API cat <<USAGE_API
Return last saved error code Return last saved error code
USAGE_API USAGE_API
echo -e "${GREEN} endReturn [OPTIONS] [MESSAGE]${NC}" echo -e "${GREEN} endReturn [OPTIONS] [MESSAGE]${NC}"
cat <<USAGE_API cat <<USAGE_API
Notifys user that there was an error (previously saved by saveReturn, Notifys user that there was an error (previously saved by saveReturn,
or -o [ERRORCODE]) and asks to continue or end the sequence. or -o [ERRORCODE]) and asks to continue or end the sequence.
Always exits with evaluated error code. Always exits with evaluated error code.
@@ -272,8 +272,8 @@ cat <<USAGE_API
String which is displayed in the error output String which is displayed in the error output
USAGE_API USAGE_API
echo -e "${GREEN} exitIfRunning${NC}" echo -e "${GREEN} exitIfRunning${NC}"
cat <<USAGE_API cat <<USAGE_API
End sequence if an instance of it is still running End sequence if an instance of it is still running
USAGE_API USAGE_API
@@ -281,10 +281,10 @@ USAGE_API
# check if there is another PID other than this one # check if there is another PID other than this one
exitIfRunning() { exitIfRunning() {
if pidof -o %PPID -x "${0##*/}">>/dev/null; then if pidof -o %PPID -x "${0##*/}">>/dev/null; then
echoseq " [E] Sequence already running" echoseq " [E] Sequence already running"
exit 1 exit 1
fi fi
} }
# Echo only if not -qq ($QUIET -ne 2) # Echo only if not -qq ($QUIET -ne 2)
@@ -320,7 +320,7 @@ outColor() {
*) *)
tput setaf $1;; tput setaf $1;;
esac esac
case "$2" in case "$2" in
black) black)
tput setab 0;; tput setab 0;;
@@ -491,7 +491,7 @@ listProfiles() {
echo ${file%.*} echo ${file%.*}
done done
} }
# initSeqConfig [OPTION] <NAME> [TEMPLATE] # initSeqConfig [OPTION] <NAME> [TEMPLATE]
# Create a configuration file in the users' home. # Create a configuration file in the users' home.
# Source it if already existent # Source it if already existent
@@ -543,7 +543,7 @@ initSeqConfig() {
echoseq -n " [I] Creating $(realpath $configDir)..." echoseq -n " [I] Creating $(realpath $configDir)..."
exe install -m 700 -d "$configDir" && echoseq "Ok" || echoseq "Nok" exe install -m 700 -d "$configDir" && echoseq "Ok" || echoseq "Nok"
fi fi
SEQ_CONFIG_HOME="$configDir" SEQ_CONFIG_HOME="$configDir"
if [ -s "$configLoc" ] ; then if [ -s "$configLoc" ] ; then
@@ -568,7 +568,7 @@ initSeqConfig() {
# Config does not exist, check for template # Config does not exist, check for template
if [ -s "$configTemplate" ] ; then if [ -s "$configTemplate" ] ; then
# Check first if there is an existing configuration at the templates position # Check first if there is an existing configuration at the templates position
local configExists="$(dirname $configTemplate)/$1" local configExists="$(dirname $configTemplate)/$1"
if [ -s "$configExists" ] ; then if [ -s "$configExists" ] ; then
@@ -668,7 +668,7 @@ addConf() {
;; ;;
esac esac
done done
local source="$1" local source="$1"
local dest="$2" local dest="$2"
@@ -725,7 +725,7 @@ addConf() {
echo -n "### " >> "$MISSING_CONF" echo -n "### " >> "$MISSING_CONF"
date >> "$MISSING_CONF" date >> "$MISSING_CONF"
fi fi
local helpText="needs to be added manually" local helpText="needs to be added manually"
if [ "$confMode" == "-s" ] ; then if [ "$confMode" == "-s" ] ; then
helpText="not overwritten" helpText="not overwritten"
@@ -904,7 +904,7 @@ selection() {
local selection_array=("$@") local selection_array=("$@")
[ ${#selection_array[@]} -eq 0 ] && return 1 [ ${#selection_array[@]} -eq 0 ] && return 1
echoseq " [I] Starting sequence $(realpath $0) ..." echoseq " [I] Starting sequence $(realpath $0) ..."
for selection_i in ${selection_array[@]} ; do for selection_i in ${selection_array[@]} ; do
@@ -943,10 +943,10 @@ step_config() {
## Called once before executing steps. ## Called once before executing steps.
## e.g. to source a config file manually: ## e.g. to source a config file manually:
#. "\$CONFIG_FILE" #. "\$CONFIG_FILE"
## or to use sequencer api with profile config file support: ## or to use sequencer api with profile config file support:
#initSeqConfig -p "\$SCRIPT_NAME" "\$CONFIG_FILE_TEMPLATE" #initSeqConfig -p "\$SCRIPT_NAME" "\$CONFIG_FILE_TEMPLATE"
## or to use sequencer api with global config file: ## or to use sequencer api with global config file:
#initSeqConfig "\$CONFIG_FILE_NAME" "\$CONFIG_FILE_TEMPLATE" #initSeqConfig "\$CONFIG_FILE_NAME" "\$CONFIG_FILE_TEMPLATE"
#if [ \$? -eq 0 ] ; then #if [ \$? -eq 0 ] ; then
@@ -1173,7 +1173,7 @@ exe() {
if [ $DRY -ne 0 ] || [ $VERBOSE -eq 1 ] ; then if [ $DRY -ne 0 ] || [ $VERBOSE -eq 1 ] ; then
(set -x; : "$@") (set -x; : "$@")
fi fi
if [ $DRY -eq 0 ] ; then if [ $DRY -eq 0 ] ; then
"$@" "$@"
fi fi
@@ -1267,7 +1267,7 @@ main() {
exit 0;; exit 0;;
esac esac
done done
# Don't show help if only configuration should be edited # Don't show help if only configuration should be edited
[ $SEQ_CONFIG_EDIT -ne 0 ] && [ -z "$1" ] && QUIET=2 [ $SEQ_CONFIG_EDIT -ne 0 ] && [ -z "$1" ] && QUIET=2
@@ -1357,7 +1357,7 @@ main() {
echoerr " [E] Sequence does not have a configuration file" echoerr " [E] Sequence does not have a configuration file"
return 1 return 1
fi fi
# Check for profile support # Check for profile support
if [ $SEQ_PROFILE_LIST -ne 0 ]; then if [ $SEQ_PROFILE_LIST -ne 0 ]; then
listProfiles; exit $? listProfiles; exit $?