markdown_exec 1.3.8 → 1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.pryrc +11 -0
- data/.rubocop.yml +15 -1
- data/CHANGELOG.md +41 -2
- data/Gemfile +1 -0
- data/Gemfile.lock +5 -1
- data/Rakefile +11 -7
- data/bin/bmde +11 -0
- data/bin/colorize_env_vars.sh +7 -0
- data/bin/tab_completion.sh +19 -19
- data/examples/duplicate_block.md +10 -0
- data/examples/import0.md +8 -0
- data/examples/import1.md +10 -0
- data/examples/include.md +12 -0
- data/examples/infile_config.md +10 -0
- data/examples/linked1.md +28 -0
- data/examples/linked2.md +29 -0
- data/examples/linked3.md +12 -0
- data/examples/opts.md +13 -0
- data/examples/pass-through.md +14 -0
- data/examples/plant.md +23 -0
- data/examples/port.md +23 -0
- data/examples/vars.md +20 -0
- data/examples/wrap.md +33 -0
- data/lib/block_types.rb +7 -0
- data/lib/cached_nested_file_reader.rb +0 -1
- data/lib/colorize.rb +61 -50
- data/lib/fcb.rb +12 -30
- data/lib/filter.rb +14 -10
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/markdown_exec.rb +1039 -541
- data/lib/mdoc.rb +106 -84
- data/lib/menu.src.yml +341 -267
- data/lib/menu.yml +342 -268
- data/lib/method_sorter.rb +76 -0
- data/lib/sort_yaml_gpt4.rb +32 -0
- metadata +22 -6
- data/lib/env_opts.rb +0 -242
- data/lib/markdown_block_manager.rb +0 -64
- data/lib/menu_options.rb +0 -0
- data/lib/menu_options.yml +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25d73d643251be40fcf14edd59a890d3d4fca847217b02c9ee6ad6fdbb06b72e
|
4
|
+
data.tar.gz: 8bde8d7e84230d50f34425fa3d549c9bbf7b78bb89219290a454547ba6a6b001
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04fec544c21aac267c89868755a76cbc0f0565cc676ed3ed647ab9459c7308cf01a26572cb059a0aadc26c403067b3ead4fcd2ce5d05051320ee2aa2b8dee911
|
7
|
+
data.tar.gz: 3f6ffedbddbf9a15c3fa7c05b24f61367dbff5c717328a333b1cded39ebba13e18f333383f4d35786b565b8985f2433e683daadf01a89963a606471415a4a503
|
data/.pryrc
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
if defined?(PryByebug)
|
2
|
+
Pry.config.pager = false
|
3
|
+
Pry.commands.alias_command 'c', 'continue'
|
4
|
+
Pry.commands.alias_command 'f', 'finish'
|
5
|
+
Pry.commands.alias_command 's', 'step'
|
6
|
+
Pry.commands.alias_command 'n', 'next'
|
7
|
+
|
8
|
+
Pry::Commands.command /^$/, 'repeat last command' do
|
9
|
+
_pry_.run_command Pry.history.to_a.last
|
10
|
+
end
|
11
|
+
end
|
data/.rubocop.yml
CHANGED
@@ -15,7 +15,6 @@ Layout/LineContinuationLeadingSpace:
|
|
15
15
|
|
16
16
|
Layout/LineLength:
|
17
17
|
Max: 96
|
18
|
-
# Max: 120
|
19
18
|
|
20
19
|
Lint/Debugger:
|
21
20
|
Enabled: false
|
@@ -65,6 +64,9 @@ Style/DoubleNegation:
|
|
65
64
|
Style/EmptyElse:
|
66
65
|
Enabled: false
|
67
66
|
|
67
|
+
Style/FormatStringToken:
|
68
|
+
Enabled: false
|
69
|
+
|
68
70
|
Style/GlobalVars:
|
69
71
|
Enabled: false
|
70
72
|
|
@@ -74,6 +76,18 @@ Style/MixinUsage:
|
|
74
76
|
Style/MultilineBlockChain:
|
75
77
|
Enabled: false
|
76
78
|
|
79
|
+
Style/PerlBackrefs: # Prefer ::Regexp.last_match.post_match over $'.
|
80
|
+
Enabled: false
|
81
|
+
|
82
|
+
Style/RegexpLiteral:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Style/Semicolon: # Do not use semicolons to terminate expressions.
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
Style/SingleLineMethods: # Avoid single-line method definitions.
|
89
|
+
Enabled: false
|
90
|
+
|
77
91
|
Style/SlicingWithRange:
|
78
92
|
Enabled: false
|
79
93
|
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,44 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.3.9] - 2023-10-29
|
4
|
+
|
5
|
+
Add block types for linking and variable control
|
6
|
+
|
7
|
+
Rename options to match use.
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- Pass-through arguments after "--" to the executed script.
|
12
|
+
See document `examples/pass-through.md`.
|
13
|
+
|
14
|
+
- Add RGB color specification to basic ANSI color names.
|
15
|
+
Foreground R, G, and B values are encoded in the name "fg_rgb_R_G_B" with their decimal values.
|
16
|
+
e.g. red = "fg_rgb_255_0_0"
|
17
|
+
e.g. green = "fg_rgb_0_255_0"
|
18
|
+
e.g. blue = "fg_rgb_0_0_255"
|
19
|
+
|
20
|
+
- Add a "link" fenced code block type as a menu choice to load a different document.
|
21
|
+
The `link` block can specify:
|
22
|
+
- environment variables and values to set prior to loading the document,
|
23
|
+
- a block name to execute in the loaded document.
|
24
|
+
In the resulting menu, an automatic option (Back) allows the user to return to the original document.
|
25
|
+
See documents `examples/linked1.md`, `examples/linked2.md`.
|
26
|
+
|
27
|
+
- Add an "opts" fenced code block type as a menu choice to set current MDE options.
|
28
|
+
See document `examples/opts.md`.
|
29
|
+
|
30
|
+
- Add a "vars" fenced code block type as a menu choice to set current environment variables.
|
31
|
+
See document `examples/vars.md`.
|
32
|
+
These blocks can be hidden blocks and required in a script.
|
33
|
+
|
34
|
+
- Add a "wrap" fenced code block type to facilitate script generation.
|
35
|
+
See document `examples/wrap.md`.
|
36
|
+
These blocks are hidden and can be required by one or more blocks.
|
37
|
+
|
38
|
+
### Changed
|
39
|
+
|
40
|
+
- Rename RegExp options to match use.
|
41
|
+
|
3
42
|
## [1.3.8] - 2023-10-20
|
4
43
|
|
5
44
|
### Added
|
@@ -230,8 +269,8 @@ e.g. `MDE_OUTPUT_VIEWER_OPTIONS="-a '/Applications/Sublime Text.app'" mde --sele
|
|
230
269
|
| block_name_hidden_match | MDE_BLOCK_NAME_HIDDEN_MATCH | `^\(.+\)$` |
|
231
270
|
| block_name_match | MDE_BLOCK_NAME_MATCH | `:(?<title>\S+)( \|$)` |
|
232
271
|
| block_required_scan | MDE_BLOCK_REQUIRED_SCAN | `\+\S+` |
|
233
|
-
|
|
234
|
-
|
|
272
|
+
| fenced_start_and_end_regex | MDE_FENCED_START_AND_END_REGEX | ``^`{3,}`` |
|
273
|
+
| fenced_start_extended_regex | MDE_FENCED_START_EXTENDED_REGEX | ``^`{3,}(?<shell>[^`\s]*) *(?<name>.*)$`` |
|
235
274
|
| heading1_match | MDE_HEADING1_MATCH | `^# *(?<name>[^#]*?) *$` |
|
236
275
|
| heading2_match | MDE_HEADING2_MATCH | `^## *(?<name>[^#]*?) *$` |
|
237
276
|
| heading3_match | MDE_HEADING3_MATCH | `^### *(?<name>.+?) *$` |
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
markdown_exec (1.
|
4
|
+
markdown_exec (1.4)
|
5
5
|
clipboard (~> 1.3.6)
|
6
6
|
open3 (~> 0.1.1)
|
7
7
|
optparse (~> 0.1.1)
|
@@ -54,6 +54,8 @@ GEM
|
|
54
54
|
nokogiri (>= 1.12.0)
|
55
55
|
method_source (1.0.0)
|
56
56
|
minitest (5.20.0)
|
57
|
+
mocha (2.1.0)
|
58
|
+
ruby2_keywords (>= 0.0.5)
|
57
59
|
nokogiri (1.15.4-arm64-darwin)
|
58
60
|
racc (~> 1.4)
|
59
61
|
open3 (0.1.2)
|
@@ -138,6 +140,7 @@ GEM
|
|
138
140
|
rubocop-capybara (~> 2.17)
|
139
141
|
rubocop-factory_bot (~> 2.22)
|
140
142
|
ruby-progressbar (1.13.0)
|
143
|
+
ruby2_keywords (0.0.5)
|
141
144
|
shellwords (0.1.0)
|
142
145
|
thor (1.2.2)
|
143
146
|
tty-color (0.6.0)
|
@@ -166,6 +169,7 @@ DEPENDENCIES
|
|
166
169
|
erb
|
167
170
|
markdown_exec!
|
168
171
|
minitest
|
172
|
+
mocha
|
169
173
|
pry-nav
|
170
174
|
pry-stack_explorer
|
171
175
|
railties
|
data/Rakefile
CHANGED
@@ -81,7 +81,7 @@ task :minitest do
|
|
81
81
|
'./lib/cached_nested_file_reader.rb',
|
82
82
|
'./lib/fcb.rb',
|
83
83
|
'./lib/filter.rb',
|
84
|
-
'./lib/
|
84
|
+
'./lib/markdown_exec.rb',
|
85
85
|
'./lib/mdoc.rb',
|
86
86
|
'./lib/object_present.rb',
|
87
87
|
'./lib/option_value.rb',
|
@@ -91,12 +91,10 @@ task :minitest do
|
|
91
91
|
]
|
92
92
|
|
93
93
|
commands.each do |command|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
exit 1
|
99
|
-
end
|
94
|
+
raise "Failed: #{command}" unless system("bundle exec ruby #{command}")
|
95
|
+
rescue StandardError => err
|
96
|
+
puts "Error: #{err.message}"
|
97
|
+
exit 1
|
100
98
|
end
|
101
99
|
end
|
102
100
|
|
@@ -105,6 +103,12 @@ task :reek do
|
|
105
103
|
`reek --config .reek .`
|
106
104
|
end
|
107
105
|
|
106
|
+
desc 'test'
|
107
|
+
task :test do
|
108
|
+
Rake::Task['minitest'].execute
|
109
|
+
system 'bundle exec rspec'
|
110
|
+
end
|
111
|
+
|
108
112
|
private
|
109
113
|
|
110
114
|
# write menu.yml
|
data/bin/bmde
ADDED
data/bin/tab_completion.sh
CHANGED
@@ -13,7 +13,7 @@ __filedirs_all()
|
|
13
13
|
}
|
14
14
|
|
15
15
|
_mde_echo_version() {
|
16
|
-
echo "1.
|
16
|
+
echo "1.4"
|
17
17
|
}
|
18
18
|
|
19
19
|
_mde() {
|
@@ -40,14 +40,6 @@ _mde() {
|
|
40
40
|
|
41
41
|
-f) COMPREPLY="."; return 0 ;;
|
42
42
|
|
43
|
-
--path) COMPREPLY="."; return 0 ;;
|
44
|
-
|
45
|
-
-p) COMPREPLY="."; return 0 ;;
|
46
|
-
|
47
|
-
--user-must-approve) COMPREPLY="1"; return 0 ;;
|
48
|
-
|
49
|
-
-q) COMPREPLY="1"; return 0 ;;
|
50
|
-
|
51
43
|
--list-count) COMPREPLY="32"; return 0 ;;
|
52
44
|
|
53
45
|
--output-execution-summary) COMPREPLY="0"; return 0 ;;
|
@@ -56,6 +48,10 @@ _mde() {
|
|
56
48
|
|
57
49
|
--output-stdout) COMPREPLY="1"; return 0 ;;
|
58
50
|
|
51
|
+
--path) COMPREPLY="."; return 0 ;;
|
52
|
+
|
53
|
+
-p) COMPREPLY="."; return 0 ;;
|
54
|
+
|
59
55
|
--save-executed-script) COMPREPLY="0"; return 0 ;;
|
60
56
|
|
61
57
|
--save-execution-output) COMPREPLY="0"; return 0 ;;
|
@@ -64,6 +60,10 @@ _mde() {
|
|
64
60
|
|
65
61
|
--saved-stdout-folder) COMPREPLY="logs"; return 0 ;;
|
66
62
|
|
63
|
+
--user-must-approve) COMPREPLY="1"; return 0 ;;
|
64
|
+
|
65
|
+
-q) COMPREPLY="1"; return 0 ;;
|
66
|
+
|
67
67
|
--display-level) COMPREPLY="1"; return 0 ;;
|
68
68
|
|
69
69
|
esac
|
@@ -74,7 +74,7 @@ _mde() {
|
|
74
74
|
# present matching option names
|
75
75
|
#
|
76
76
|
if [[ ${cur} == -* ]] ; then
|
77
|
-
opts=("--block-name" "--config" "--debug" "--
|
77
|
+
opts=("--block-name" "--config" "--debug" "--exit" "--filename" "--help" "--list-blocks" "--list-count" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--output-execution-summary" "--output-script" "--output-stdout" "--path" "--pwd" "--run-last-script" "--save-executed-script" "--save-execution-output" "--saved-script-folder" "--saved-stdout-folder" "--select-recent-output" "--select-recent-script" "--tab-completions" "--user-must-approve" "--version" "--display-level")
|
78
78
|
COMPREPLY=( $(compgen -W "$(printf "'%s' " "${opts[@]}")" -- "${cur}") )
|
79
79
|
|
80
80
|
return 0
|
@@ -101,14 +101,6 @@ _mde() {
|
|
101
101
|
|
102
102
|
-f) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
103
103
|
|
104
|
-
--path) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
105
|
-
|
106
|
-
-p) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
107
|
-
|
108
|
-
--user-must-approve) COMPREPLY=".BOOL."; return 0 ;;
|
109
|
-
|
110
|
-
-q) COMPREPLY=".BOOL."; return 0 ;;
|
111
|
-
|
112
104
|
--list-count) COMPREPLY=".INT.1-."; return 0 ;;
|
113
105
|
|
114
106
|
--output-execution-summary) COMPREPLY=".BOOL."; return 0 ;;
|
@@ -117,6 +109,10 @@ _mde() {
|
|
117
109
|
|
118
110
|
--output-stdout) COMPREPLY=".BOOL."; return 0 ;;
|
119
111
|
|
112
|
+
--path) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
113
|
+
|
114
|
+
-p) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
115
|
+
|
120
116
|
--save-executed-script) COMPREPLY=".BOOL."; return 0 ;;
|
121
117
|
|
122
118
|
--save-execution-output) COMPREPLY=".BOOL."; return 0 ;;
|
@@ -125,6 +121,10 @@ _mde() {
|
|
125
121
|
|
126
122
|
--saved-stdout-folder) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
127
123
|
|
124
|
+
--user-must-approve) COMPREPLY=".BOOL."; return 0 ;;
|
125
|
+
|
126
|
+
-q) COMPREPLY=".BOOL."; return 0 ;;
|
127
|
+
|
128
128
|
--display-level) COMPREPLY=".INT.0-3."; return 0 ;;
|
129
129
|
|
130
130
|
esac
|
@@ -138,4 +138,4 @@ _mde() {
|
|
138
138
|
|
139
139
|
complete -o filenames -o nospace -F _mde mde
|
140
140
|
# _mde_echo_version
|
141
|
-
# echo "Updated: 2023-10-
|
141
|
+
# echo "Updated: 2023-10-31 15:43:43 UTC"
|
data/examples/import0.md
ADDED
data/examples/import1.md
ADDED
data/examples/include.md
ADDED
data/examples/linked1.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Demo document linking
|
2
|
+
|
3
|
+
::: * This is document 1 *
|
4
|
+
::: This document links to a matching document to demonstrate navigation between documents.
|
5
|
+
|
6
|
+
::: This Bash block displays the value of variables "page1_var_via_environment" and "page2_var_via_environment"
|
7
|
+
|
8
|
+
```bash :show_vars
|
9
|
+
source bin/colorize_env_vars.sh
|
10
|
+
colorize_env_vars 'vars for page2' PAGE2_VAR_VIA_INHERIT page2_var_via_environment
|
11
|
+
colorize_env_vars 'vars for page3' PAGE3_VAR_VIA_INHERIT page3_var_via_environment
|
12
|
+
```
|
13
|
+
|
14
|
+
::: This Link block
|
15
|
+
::: 1. requires a block that sets environment variable PAGE2_VAR_VIA_INHERIT,
|
16
|
+
::: 2. navigates to document 2, and
|
17
|
+
::: 3. executes block "show_vars" to display the imported PAGE2_VAR_VIA_INHERIT.
|
18
|
+
|
19
|
+
```bash :(vars2)
|
20
|
+
PAGE2_VAR_VIA_INHERIT=for_page2_from_page1_via_inherited_code_file
|
21
|
+
```
|
22
|
+
|
23
|
+
```link :linked2_import_vars +(vars2)
|
24
|
+
file: examples/linked2.md
|
25
|
+
block: show_vars
|
26
|
+
vars:
|
27
|
+
page2_var_via_environment: for_page2_from_page1_via_current_environment
|
28
|
+
```
|
data/examples/linked2.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Demo document linking
|
2
|
+
|
3
|
+
::: * This is document 2 *
|
4
|
+
::: This document links to a matching document to demonstrate navigation between documents.
|
5
|
+
|
6
|
+
::: This Bash block displays the value of variables "page1_var_via_environment" and "page2_var_via_environment"
|
7
|
+
|
8
|
+
```bash :show_vars
|
9
|
+
source bin/colorize_env_vars.sh
|
10
|
+
colorize_env_vars 'vars for page2' PAGE2_VAR_VIA_INHERIT page2_var_via_environment
|
11
|
+
colorize_env_vars 'vars for page3' PAGE3_VAR_VIA_INHERIT page3_var_via_environment
|
12
|
+
```
|
13
|
+
|
14
|
+
|
15
|
+
::: This Link block requires a block that
|
16
|
+
::: 1. sets environment variable PAGE3_VAR_VIA_INHERIT,
|
17
|
+
::: 2. navigates to document 3, and
|
18
|
+
::: 3. executes block "show_vars" to display the imported PAGE3_VAR_VIA_INHERIT.
|
19
|
+
|
20
|
+
```bash :(vars3)
|
21
|
+
PAGE3_VAR_VIA_INHERIT=for_page3_from_page2_via_inherited_code_file
|
22
|
+
```
|
23
|
+
|
24
|
+
```link :linked3_import_vars +(vars3)
|
25
|
+
file: examples/linked3.md
|
26
|
+
block: show_vars
|
27
|
+
vars:
|
28
|
+
page3_var_via_environment: for_page3_from_page2_via_current_environment
|
29
|
+
```
|
data/examples/linked3.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Demo document linking
|
2
|
+
|
3
|
+
::: * This is document 3 *
|
4
|
+
::: This document is linked from another document to demonstrate code transfer.
|
5
|
+
|
6
|
+
::: This Bash block displays the value of variables "PAGE3_VAR_VIA_INHERIT" and "page3_var_via_environment"
|
7
|
+
|
8
|
+
```bash :show_vars
|
9
|
+
source bin/colorize_env_vars.sh
|
10
|
+
colorize_env_vars 'vars for page2' PAGE2_VAR_VIA_INHERIT page2_var_via_environment
|
11
|
+
colorize_env_vars 'vars for page3' PAGE3_VAR_VIA_INHERIT page3_var_via_environment
|
12
|
+
```
|
data/examples/opts.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Demo configuring options
|
2
|
+
|
3
|
+
::: These Opts blocks set the color of a couple of menu options to demonstrate the live update of options.
|
4
|
+
|
5
|
+
```opts :opts1
|
6
|
+
menu_divider_color: yellow
|
7
|
+
menu_task_color: fg_rgb_255_63_255
|
8
|
+
```
|
9
|
+
|
10
|
+
```opts :opts2
|
11
|
+
menu_divider_color: fg_rgb_255_0_255
|
12
|
+
menu_task_color: fg_rgb_127_127_255
|
13
|
+
```
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Pass-through arguments after "--" to the executed script.
|
2
|
+
|
3
|
+
A block can expect arguments to receive all arguments to MDE after "--".
|
4
|
+
|
5
|
+
For `mde examples/pass-through.md output_arguments -- 123`,
|
6
|
+
this block outputs:
|
7
|
+
|
8
|
+
ARGS: 123
|
9
|
+
|
10
|
+
::: This block will output any arguments after "--" in the command line.
|
11
|
+
|
12
|
+
```bash :output_arguments
|
13
|
+
echo "ARGS: $*"
|
14
|
+
```
|
data/examples/plant.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
::: Nourish
|
2
|
+
|
3
|
+
[ ] Observe soil moisture level
|
4
|
+
|
5
|
+
```bash :Watering_the_plant
|
6
|
+
echo glug glug glug
|
7
|
+
```
|
8
|
+
|
9
|
+
::: Maintain
|
10
|
+
|
11
|
+
[ ] Observe leaf color and health
|
12
|
+
|
13
|
+
```bash :Trimming_dead_or_yellowing_leaves
|
14
|
+
echo snip snip
|
15
|
+
```
|
16
|
+
|
17
|
+
::: Release
|
18
|
+
|
19
|
+
[ ] Observe flowering and fruiting patterns
|
20
|
+
|
21
|
+
```bash :Repotting_when_necessary
|
22
|
+
echo farewell
|
23
|
+
```
|
data/examples/port.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Demo variable porting
|
2
|
+
|
3
|
+
::: This block requires the Port block and displays the value.
|
4
|
+
::: The Port block contributes the variable VAULT to the generated script.
|
5
|
+
|
6
|
+
```bash :show +(vault)
|
7
|
+
: ${VAULT:=This variable has not been set.}
|
8
|
+
source bin/colorize_env_vars.sh
|
9
|
+
colorize_env_vars '' VAULT
|
10
|
+
```
|
11
|
+
|
12
|
+
::: Set the VAULT value in memory.
|
13
|
+
::: Call this block prior to `show` to demonstrate in-memory value being written to script.
|
14
|
+
|
15
|
+
```vars :set
|
16
|
+
VAULT: This variable was set by the "set" block.
|
17
|
+
```
|
18
|
+
|
19
|
+
::: There is an invisible Port block that saves current/live environment variable values into the generated script.
|
20
|
+
|
21
|
+
```port :(vault)
|
22
|
+
VAULT
|
23
|
+
```
|
data/examples/vars.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
```bash :(defaults)
|
2
|
+
: ${VAULT:=default}
|
3
|
+
```
|
4
|
+
```bash :show_vars +(defaults)
|
5
|
+
source bin/colorize_env_vars.sh
|
6
|
+
colorize_env_vars '' VAULT
|
7
|
+
```
|
8
|
+
```vars :set
|
9
|
+
VAULT: 11
|
10
|
+
```
|
11
|
+
```vars :set_with_show +show_vars
|
12
|
+
VAULT: 22
|
13
|
+
```
|
14
|
+
```bash :(hidden)
|
15
|
+
colorize_env_vars '' NOTHING
|
16
|
+
```
|
17
|
+
```bash :show_with_set +set
|
18
|
+
source bin/colorize_env_vars.sh
|
19
|
+
colorize_env_vars '' VAULT
|
20
|
+
```
|
data/examples/wrap.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Demo block wrapping
|
2
|
+
|
3
|
+
::: This block is wrapped by the `{outer*}` pair of blocks.
|
4
|
+
|
5
|
+
```bash :single +{outer}
|
6
|
+
echo single body - wrapped by outer
|
7
|
+
```
|
8
|
+
|
9
|
+
::: This block is wrapped first by the `{outer*}` pair of blocks
|
10
|
+
::: and nested inside, the `{inner*}` pair of blocks.
|
11
|
+
|
12
|
+
```bash :nested +{outer} +{inner}
|
13
|
+
echo nested body - wrapped by outer and then inner
|
14
|
+
```
|
15
|
+
|
16
|
+
::: This pair of hidden blocks are the `{inner*}` set.
|
17
|
+
```bash :{inner}
|
18
|
+
echo inner-before
|
19
|
+
```
|
20
|
+
|
21
|
+
```bash :{inner-after}
|
22
|
+
echo inner-after
|
23
|
+
```
|
24
|
+
|
25
|
+
::: This pair of hidden blocks are the `{outer*}` set.
|
26
|
+
|
27
|
+
```bash :{outer}
|
28
|
+
echo outer-before
|
29
|
+
```
|
30
|
+
|
31
|
+
```bash :{outer-after}
|
32
|
+
echo outer-after
|
33
|
+
```
|
data/lib/block_types.rb
ADDED