-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
abfdcaa
commit 8b2b89d
Showing
33 changed files
with
779 additions
and
616 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
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
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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
|
||
rootDir="$(cd "$(readlink -e "${BASH_SOURCE[0]%/*}")/.." && pwd -P)" | ||
export FRAMEWORK_ROOT_DIR="${rootDir}" | ||
export _COMPILE_ROOT_DIR="${rootDir}" | ||
|
||
srcDir="$(cd "${rootDir}/src" && pwd -P)" | ||
|
||
# shellcheck source=src/Object/__all.sh | ||
source "${srcDir}/Object/__all.sh" | ||
# shellcheck source=src/Options2/__all.sh | ||
source "${srcDir}/Options2/__all.sh" | ||
# shellcheck source=/src/Log/__all.sh | ||
source "${srcDir}/Log/__all.sh" | ||
# shellcheck source=/src/UI/theme.sh | ||
source "${srcDir}/UI/theme.sh" | ||
# shellcheck source=/src/Assert/tty.sh | ||
source "${srcDir}/Assert/tty.sh" | ||
|
||
declare -a arg=( | ||
--type "Arg" | ||
--property-variableName "var" | ||
--property-name "name" | ||
--property-help "help" | ||
--property-title "Global options" | ||
--property-mandatory 1 | ||
--property-max 2 | ||
) | ||
declare -a group=( | ||
--type "Group" | ||
--property-title "Global options" | ||
--property-help "help" | ||
) | ||
Options2::renderGroupHelp group | ||
declare -a arg=( | ||
--type "Arg" | ||
--property-variableName "varName" | ||
--property-variableType "String" | ||
--array-alt "--help" | ||
--property-name "valid" | ||
--array-callback "François" | ||
) | ||
Options2::validateArgObject arg | ||
UI::theme "default" | ||
Options2::renderArgHelp arg 2>&1 |
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck disable=SC2154 | ||
# shellcheck disable=SC2034 | ||
|
||
# shellcheck source=src/batsHeaders.sh | ||
source "$(cd "${BATS_TEST_DIRNAME}/.." && pwd)/batsHeaders.sh" | ||
# shellcheck source=src/Object/__all.sh | ||
source "${srcDir}/Object/__all.sh" | ||
# shellcheck source=src/Assert/posixFunctionName.sh | ||
source "${srcDir}/Assert/posixFunctionName.sh" | ||
# shellcheck source=src/Array/contains.sh | ||
source "${srcDir}/Array/contains.sh" | ||
|
||
function Object::setProperty::simpleObject { #@test | ||
declare -a simpleObject=( | ||
--type "simpleObjectType" | ||
--property-property "propertyValue" | ||
) | ||
local status=0 | ||
Object::setProperty simpleObject --property-property "newPropertyValue" || status=1 | ||
[[ "${status}" = "0" ]] | ||
run echo "${simpleObject[@]}" | ||
assert_output "--type simpleObjectType --property-property newPropertyValue" | ||
} | ||
|
||
function Object::setProperty::multipleProperties { #@test | ||
declare -a multipleProperties=( | ||
--type "multiplePropertiesType" | ||
--property-property "propertyValue" | ||
--property-property2 "propertyValue2" | ||
) | ||
local status=0 | ||
Object::setProperty multipleProperties --property-property "newPropertyValue" || status=1 | ||
[[ "${status}" = "0" ]] | ||
run echo "${multipleProperties[@]}" | ||
assert_output "--type multiplePropertiesType --property-property newPropertyValue --property-property2 propertyValue2" | ||
} | ||
|
||
function Object::setProperty::withArray { #@test | ||
declare -a withArray=( | ||
--type "withArrayType" | ||
--property-property "propertyValue" | ||
--array-list "elem1" "elem2" -- | ||
--property-property2 "propertyValue2" | ||
) | ||
local status=0 | ||
Object::setProperty withArray --property-property2 "newPropertyValue" || status=1 | ||
[[ "${status}" = "0" ]] | ||
run echo "${withArray[@]}" | ||
assert_output "--type withArrayType --property-property propertyValue --array-list "elem1" "elem2" -- --property-property2 newPropertyValue" | ||
} | ||
|
||
function Object::setProperty::newProperty { #@test | ||
declare -a newPropertyObject=( | ||
--type "simpleObjectType" | ||
--property-property "propertyValue" | ||
) | ||
local status=0 | ||
Object::setProperty newPropertyObject --property-newProperty "value" || status=1 | ||
[[ "${status}" = "0" ]] | ||
run echo "${newPropertyObject[@]}" | ||
assert_output "--type simpleObjectType --property-property propertyValue --property-newProperty value" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
Object::initFromTemplate() { | ||
local -n object_init_from_template_template=$1 | ||
local -n object_init_from_template_object=$2 | ||
shift 2 || true | ||
local propertyName="${2:-}" | ||
local propertyValue="${3:-}" | ||
|
||
local i=0 || true | ||
local -i propertiesLength="${#object_set_property_objectData[@]}" | ||
local -a newProperties=() | ||
local propertyFound="0" | ||
while ((i < propertiesLength)); do | ||
if [[ "${object_set_property_objectData[${i}]}" = "--property-${propertyName}" ]]; then | ||
propertyFound="1" | ||
newProperties+=( | ||
"${object_set_property_objectData[${i}]}" "${propertyValue}" | ||
) | ||
if ((i < propertiesLength - 2)); then | ||
newProperties+=("${object_set_property_objectData[@]:i+2}") | ||
fi | ||
break | ||
fi | ||
newProperties+=("${object_set_property_objectData[${i}]}") | ||
((i = i + 1)) | ||
done | ||
if [[ "${propertyFound}" = "0" ]]; then | ||
newProperties+=("--property-${propertyName}" "${propertyValue}") | ||
fi | ||
object_set_property_objectData=("${newProperties[@]}") | ||
} |
Oops, something went wrong.