Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bash Headstart
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cybersecurity
Bash Headstart
Commits
99086e69
Commit
99086e69
authored
4 years ago
by
Nikolaos Kakouros
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
2c2e7084
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
headstart-core.bash
+18
-18
18 additions, 18 deletions
headstart-core.bash
headstart-load-libs.bash
+0
-14
0 additions, 14 deletions
headstart-load-libs.bash
with
18 additions
and
32 deletions
headstart-core.bash
+
18
−
18
View file @
99086e69
...
...
@@ -69,6 +69,7 @@ core_get_installed_version
core_parse_project_config
function
headstart
()
{
local
trace
=
false
local
debug
=
false
local
verbosity
=
''
local
-a
rest
...
...
@@ -78,7 +79,10 @@ function headstart() {
while
[[
"$#"
-gt
0
]]
;
do
case
"
$1
"
in
-d
|
--debug
)
-d
|
--trace
)
trace
=
true
;;
-dd
|
--debug
)
debug
=
true
;;
-v
*
)
...
...
@@ -100,6 +104,19 @@ function headstart() {
shift
done
# This was originally in headstart-load-libs (as all uses of `import`) but
# was moved here in order to put the trace behind the `-d` cli option.
if
[[
"
$trace
"
==
'true'
&&
"
${
_GO_BATS_DIR
-unset
}
"
==
'unset'
]]
;
then
import util/exception
fi
# When we are testing the project's code, we want for instance to check that
# a function returns with a specific code in case of an error. In these cases,
# we do not want this error code to trigger the stack trace that the
# `util/exception` code prints as it would pollute the test output. So, we
# only import this module when not testing. To check if we are in test mode or
# not, we check the existence of a variable that is set only when testing. We
# chose randomly `_GO_BATS_DIR` that is set in `devel/test`.
.
"
$_GO_USE_MODULES
"
'installation'
'aliases'
if
[[
"
$go_early
"
==
'true'
]]
;
then
...
...
@@ -150,22 +167,5 @@ function headstart() {
core_check_upgrades
# TODO don't rely on this returning empty strings. When first installing,
# `core bootstrap` will execute this returning nothing. Instead handle that
# case better and have the function return an error code if it doesn't find
# what it needs.
if
[[
"
${
rest
[*]
}
"
!=
''
&&
"
${
rest
[0]
}
"
==
'core'
]]
;
then
if
[[
"
${#
rest
[*]
}
"
-ge
2
&&
"
${
rest
[1]
}
"
==
'bootstrap'
]]
;
then
@go
"
${
rest
[@]
}
"
return
fi
fi
if
[[
"
${
rest
[*]
}
"
==
''
]]
;
then
trap
- ERR
@go
return
fi
@go
"
${
rest
[@]
}
"
}
This diff is collapsed.
Click to expand it.
headstart-load-libs.bash
+
0
−
14
View file @
99086e69
...
...
@@ -51,20 +51,6 @@ import util/tryCatch
import util/variable
import util/namedParameters
# TODO do I need this?
# if [[ "${_GO_BATS_DIR-unset}" == 'unset' ]]; then
import util/exception
# fi
# <<-CODE-NOTE: When we are testing the project's code, we want for instance to
# check that a function returns with a specific code in case of
# an error. In these cases, we do not want this error code to
# trigger the stack trace that the `util/exception` code prints
# as it would pollute the test output. So, we only import this
# module when not testing. To check if we are in test mode or
# not, we check the existence of a variable that is set only when
# testing. We chose randomly `_GO_BATS_DIR` that is set in
# `devel/test`.
# CUSTOM LIBS
# ===========
# TODO source directly due to variable scoping
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment