-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtemplate_ex
More file actions
executable file
·31 lines (23 loc) · 907 Bytes
/
template_ex
File metadata and controls
executable file
·31 lines (23 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#
# Illustrates a recommended (but *not* required) workflow when using
# structs and collections from the library.
#
# In summary, it is valuable to always check context at the end of the
# execution (even if you do not create your own context, but you rely
# on the global context). Of course, you can combine this with your
# regular debugging, using -e (which is limited) and -x.
readonly DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. ${DIR}/../gobash
function main() {
local -r ctx="${1}"
local -r flags=$(Flags $ctx "Your tool name.")
# Parse flags below this line.
# Include any code you wish.
}
# Make a context for this run.
ctx=$(ctx_make)
main $ctx "$@" || { ctx_w $ctx "main failed"; ctx_show $ctx; exit 1; }
# Recommended to print the context at the end of any execution, any
# command can easily "eat" an exit status.
ctx_show $ctx