markdown_exec 3.4.0 → 3.5.1
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/CHANGELOG.md +25 -0
- data/Dockerfile.test +42 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +11 -1
- data/README.md +283 -144
- data/Rakefile +34 -26
- data/bats/block-type-shell-require-ux.bats +15 -0
- data/bats/block-type-ux-echo.bats +1 -1
- data/bats/block-type-ux-require-context.bats +14 -0
- data/bats/import-directive-line-continuation.bats +1 -1
- data/bats/import-directive-parameter-symbols.bats +1 -1
- data/bats/import-parameter-symbols.bats +1 -1
- data/bats/options.bats +2 -2
- data/bin/bmde +1 -1
- data/demo/trap.demo1.gif +0 -0
- data/demo/trap.demo1.mp4 +0 -0
- data/docs/dev/block-type-shell-require-ux.md +18 -0
- data/docs/dev/block-type-ux-echo.md +2 -1
- data/docs/dev/block-type-ux-format.md +10 -0
- data/docs/dev/block-type-ux-require-context.md +32 -0
- data/docs/dev/block-type-ux-require.md +8 -4
- data/docs/dev/import-directive-line-continuation.md +0 -1
- data/docs/dev/import-directive-parameter-symbols.md +0 -2
- data/docs/dev/import-parameter-symbols-template.md +7 -5
- data/docs/dev/import-parameter-symbols.md +10 -2
- data/docs/docker-testing.md +115 -0
- data/docs/tab-completion.md +33 -0
- data/examples/colors.md +31 -29
- data/lib/cached_nested_file_reader.rb +15 -47
- data/lib/collapser.rb +1 -1
- data/lib/command_result.rb +5 -5
- data/lib/constants.rb +3 -1
- data/lib/evaluate_shell_expressions.rb +1 -1
- data/lib/fcb.rb +7 -1
- data/lib/find_files.rb +1 -2
- data/lib/hash_delegator.rb +76 -32
- data/lib/input_sequencer.rb +1 -1
- data/lib/instance_method_wrapper.rb +1 -1
- data/lib/link_history.rb +1 -1
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/markdown_exec.rb +1 -1
- data/lib/menu.src.yml +18 -8
- data/lib/menu.yml +14 -5
- data/lib/parameter_expansion.rb +918 -0
- data/lib/parse_animation_to_tts.rb +4417 -0
- data/lib/resize_terminal.rb +21 -32
- metadata +14 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6becba5a0ff94fb60399da0fc99248fff83905def9c65e4a8e1ae9c597652036
|
|
4
|
+
data.tar.gz: 98f0d4ad3764fec26b4ed8f1bce1904af1f350853b3e2678847f0557b381e8bf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b2d1d60bcf1fe258a8be76893b070ab418563e27923c9e8a4370cd04fa5e0d421732c3c51e76e596a5d492885170270437916035530f64ba2e99a98d215bd908
|
|
7
|
+
data.tar.gz: 306d802cfcfc5bfa9460e2d58a69ac4f9ac0c058a28859243a237682d2622549277ff6f8515f84c51b2a2ede229c3f95eaa9a0ce5b9dbde98bfc2ad862c9aa8f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.5.1] - 2025-11-14
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Docker testing environment.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Correct tests for Docker environment.
|
|
12
|
+
- Uses env split mode to parse the shell command.
|
|
13
|
+
|
|
14
|
+
## [3.5.0] - 2025-11-13
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- MP4 with demonstration of Bash "trap" command.
|
|
19
|
+
- Type casting for tokens in imported documents.
|
|
20
|
+
- Default color for fenced code blocks per type.
|
|
21
|
+
- Shell blocks can require UX blocks.
|
|
22
|
+
- Common markdown patterns for text decorations.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- README.md
|
|
27
|
+
|
|
3
28
|
## [3.4.0] - 2025-09-16
|
|
4
29
|
|
|
5
30
|
### Added
|
data/Dockerfile.test
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
FROM ruby:3.3-bookworm
|
|
2
|
+
|
|
3
|
+
ENV LANG C.UTF-8
|
|
4
|
+
|
|
5
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
6
|
+
build-essential \
|
|
7
|
+
bsdmainutils \
|
|
8
|
+
gawk \
|
|
9
|
+
git \
|
|
10
|
+
tree \
|
|
11
|
+
vim
|
|
12
|
+
|
|
13
|
+
# `markdown_exec` is the name expected by some BATS tests
|
|
14
|
+
WORKDIR /markdown_exec
|
|
15
|
+
|
|
16
|
+
# Clone the repository (shallow clone for faster builds)
|
|
17
|
+
ARG GIT_BRANCH=main
|
|
18
|
+
RUN git clone --depth 1 --branch ${GIT_BRANCH} https://github.com/fareedst/markdown_exec.git .
|
|
19
|
+
|
|
20
|
+
# Initialize and update git submodules
|
|
21
|
+
RUN git submodule update --init --recursive
|
|
22
|
+
|
|
23
|
+
# Install dependencies
|
|
24
|
+
RUN bundle install
|
|
25
|
+
|
|
26
|
+
# Add aliases
|
|
27
|
+
RUN echo 'alias batsv="bats --verbose-run --show-output-of-passing-tests"' >> ~/.bashrc && \
|
|
28
|
+
echo 'alias be="bundle exec"' >> ~/.bashrc && \
|
|
29
|
+
echo 'alias bmde="bin/bmde"' >> ~/.bashrc && \
|
|
30
|
+
echo 'alias ll="ls -FGlAhp"' >> ~/.bashrc
|
|
31
|
+
|
|
32
|
+
RUN git submodule add https://github.com/bats-core/bats-core.git test/bats && \
|
|
33
|
+
git submodule add https://github.com/bats-core/bats-support.git test/test_helper/bats-support && \
|
|
34
|
+
git submodule add https://github.com/bats-core/bats-assert.git test/test_helper/bats-assert
|
|
35
|
+
|
|
36
|
+
# make dirs, file for BATS tests
|
|
37
|
+
RUN mkdir -p logs
|
|
38
|
+
RUN mkdir -p docs/research
|
|
39
|
+
RUN echo '04:31 e' > logs/mde_site.local_2024-07-31-20-04-01___examples_save_md_~_test_.out.txt
|
|
40
|
+
RUN ln -s /markdown_exec/test/bats/bin/bats /usr/local/bin/
|
|
41
|
+
|
|
42
|
+
CMD ["bash"]
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
markdown_exec (3.
|
|
4
|
+
markdown_exec (3.5.1)
|
|
5
5
|
clipboard (~> 1.3.6)
|
|
6
6
|
open3 (~> 0.1.1)
|
|
7
7
|
optparse (~> 0.1.1)
|
|
@@ -37,6 +37,7 @@ GEM
|
|
|
37
37
|
minitest (>= 5.1)
|
|
38
38
|
mutex_m
|
|
39
39
|
tzinfo (~> 2.0)
|
|
40
|
+
ansi (1.5.0)
|
|
40
41
|
ast (2.4.2)
|
|
41
42
|
base64 (0.2.0)
|
|
42
43
|
bigdecimal (3.1.8)
|
|
@@ -98,9 +99,16 @@ GEM
|
|
|
98
99
|
nokogiri (>= 1.12.0)
|
|
99
100
|
method_source (1.1.0)
|
|
100
101
|
minitest (5.24.1)
|
|
102
|
+
minitest-reporters (1.7.1)
|
|
103
|
+
ansi
|
|
104
|
+
builder
|
|
105
|
+
minitest (>= 5.0)
|
|
106
|
+
ruby-progressbar
|
|
101
107
|
mocha (2.4.5)
|
|
102
108
|
ruby2_keywords (>= 0.0.5)
|
|
103
109
|
mutex_m (0.2.0)
|
|
110
|
+
nokogiri (1.16.6-aarch64-linux)
|
|
111
|
+
racc (~> 1.4)
|
|
104
112
|
nokogiri (1.16.6-arm64-darwin)
|
|
105
113
|
racc (~> 1.4)
|
|
106
114
|
open3 (0.1.2)
|
|
@@ -218,6 +226,7 @@ GEM
|
|
|
218
226
|
zeitwerk (2.6.16)
|
|
219
227
|
|
|
220
228
|
PLATFORMS
|
|
229
|
+
aarch64-linux
|
|
221
230
|
arm64-darwin-21
|
|
222
231
|
|
|
223
232
|
DEPENDENCIES
|
|
@@ -227,6 +236,7 @@ DEPENDENCIES
|
|
|
227
236
|
irb
|
|
228
237
|
markdown_exec!
|
|
229
238
|
minitest
|
|
239
|
+
minitest-reporters
|
|
230
240
|
mocha
|
|
231
241
|
pry-nav
|
|
232
242
|
pry-stack_explorer
|
data/README.md
CHANGED
|
@@ -1,211 +1,350 @@
|
|
|
1
1
|
# MarkdownExec
|
|
2
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
3
|
+
[](https://raw.githubusercontent.com/fareedst/markdown_exec/main/demo/trap.demo1.mp4)
|
|
4
|
+
|
|
5
|
+
*Click the GIF above to view the full video with audio (MP4)*
|
|
6
|
+
|
|
7
|
+
Transform static markdown into interactive, executable workflows. Build complex scripts with named blocks, interactive forms, cross-document navigation, and template systems.
|
|
8
|
+
|
|
9
|
+
## Key Features
|
|
10
|
+
|
|
11
|
+
### Interactive Code Execution
|
|
12
|
+
- **Named Blocks**: Create reusable code blocks with dependencies
|
|
13
|
+
- **Block Requirements**: Automatically include required blocks in execution order
|
|
14
|
+
- **Interactive Selection**: Choose blocks from intuitive menus
|
|
15
|
+
- **Script Approval**: Review generated scripts before execution
|
|
16
|
+
|
|
17
|
+
### UX Blocks - Interactive Forms
|
|
18
|
+
- **Variable Input**: Create interactive forms for user input
|
|
19
|
+
- **Validation**: Built-in regex validation with custom transforms
|
|
20
|
+
- **Dynamic Menus**: Selection from allowed values or command output
|
|
21
|
+
- **Auto-initialization**: Set values from environment, commands, or defaults
|
|
22
|
+
- **Dependencies**: Chain UX blocks with complex relationships
|
|
23
|
+
|
|
24
|
+
### Cross-Document Navigation
|
|
25
|
+
- **Link Blocks**: Navigate between markdown files seamlessly
|
|
26
|
+
- **Variable Passing**: Share data between documents
|
|
27
|
+
- **Inherited Context**: Maintain state across document boundaries
|
|
28
|
+
- **HyperCard-style Navigation**: Create interactive document stacks
|
|
29
|
+
|
|
30
|
+
### Template System & Imports
|
|
31
|
+
- **Import Directives**: Include content from other files with `@import`
|
|
32
|
+
- **Parameter Substitution**: Replace variables in imported content
|
|
33
|
+
- **Shell Expansions**: Use `${variable}` and `$(command)` syntax throughout documents
|
|
34
|
+
- **Dynamic Content**: Generate content based on user selections
|
|
35
|
+
|
|
36
|
+
### Advanced Block Types
|
|
37
|
+
- **Shell Blocks**: Execute bash shells
|
|
38
|
+
- **UX Blocks**: Interactive forms with validation, transforms, and dynamic behavior
|
|
39
|
+
- **Vars Blocks**: Define variables in YAML format
|
|
40
|
+
- **Opts Blocks**: Configure document behavior and appearance
|
|
41
|
+
- **Link Blocks**: Cross-document navigation and variable passing
|
|
42
|
+
|
|
43
|
+
### State Management
|
|
44
|
+
- **Script Persistence**: Save and replay executed scripts
|
|
45
|
+
- **Output Logging**: Capture and review execution results
|
|
46
|
+
- **State Inheritance**: Manage context across sessions
|
|
47
|
+
- **Configuration**: Flexible options via environment, files, or CLI
|
|
34
48
|
|
|
35
49
|
## Installation
|
|
36
50
|
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
```bash
|
|
52
|
+
gem install markdown_exec
|
|
53
|
+
```
|
|
39
54
|
|
|
40
|
-
##
|
|
55
|
+
## Quick Start
|
|
41
56
|
|
|
42
|
-
###
|
|
57
|
+
### Interactive Mode (Recommended)
|
|
58
|
+
```bash
|
|
59
|
+
mde # Process README.md in current folder
|
|
60
|
+
mde my-document.md # Process specific markdown file
|
|
61
|
+
mde . # Select from markdown files in current folder
|
|
62
|
+
```
|
|
43
63
|
|
|
44
|
-
|
|
64
|
+
### Command Line Mode
|
|
65
|
+
```bash
|
|
66
|
+
mde my-document.md my-block # Execute specific block directly
|
|
67
|
+
mde --list-blocks # List all available blocks
|
|
68
|
+
mde --list-docs # List all markdown documents
|
|
69
|
+
```
|
|
45
70
|
|
|
46
|
-
|
|
71
|
+
## Interactive Features
|
|
47
72
|
|
|
48
|
-
###
|
|
73
|
+
### UX Blocks - Interactive Forms
|
|
49
74
|
|
|
50
|
-
|
|
75
|
+
Create interactive forms that prompt users for input:
|
|
51
76
|
|
|
52
|
-
|
|
77
|
+
<pre><code>```ux
|
|
78
|
+
name: USER_NAME
|
|
79
|
+
prompt: Enter your name
|
|
80
|
+
init: Guest
|
|
81
|
+
```
|
|
82
|
+
</code></pre>
|
|
83
|
+
|
|
84
|
+
<pre><code>```ux
|
|
85
|
+
name: ENVIRONMENT
|
|
86
|
+
allow:
|
|
87
|
+
- development
|
|
88
|
+
- staging
|
|
89
|
+
- production
|
|
90
|
+
prompt: Select environment
|
|
91
|
+
```
|
|
92
|
+
</code></pre>
|
|
53
93
|
|
|
54
|
-
|
|
94
|
+
<pre><code>```ux
|
|
95
|
+
name: EMAIL
|
|
96
|
+
prompt: Enter email address
|
|
97
|
+
validate: '(?<local>[^@]+)@(?<domain>[^@]+)'
|
|
98
|
+
transform: '%{local}@%{domain}'
|
|
99
|
+
```
|
|
100
|
+
</code></pre>
|
|
55
101
|
|
|
56
|
-
|
|
102
|
+
### Cross-Document Navigation
|
|
57
103
|
|
|
58
|
-
|
|
104
|
+
Navigate between documents while maintaining context:
|
|
59
105
|
|
|
60
|
-
|
|
106
|
+
<pre><code>```link
|
|
107
|
+
file: next-document.md
|
|
108
|
+
vars:
|
|
109
|
+
current_user: ${USER_NAME}
|
|
110
|
+
environment: ${ENVIRONMENT}
|
|
111
|
+
```
|
|
112
|
+
</code></pre>
|
|
61
113
|
|
|
62
|
-
|
|
114
|
+
### Template System
|
|
63
115
|
|
|
64
|
-
|
|
116
|
+
Use imports with parameter substitution:
|
|
65
117
|
|
|
66
|
-
|
|
118
|
+
```
|
|
119
|
+
@import template.md USER_NAME=John ENVIRONMENT=production
|
|
120
|
+
```
|
|
121
|
+
</code></pre>
|
|
67
122
|
|
|
68
|
-
|
|
123
|
+
### Block Dependencies
|
|
69
124
|
|
|
70
|
-
|
|
125
|
+
Create complex workflows with automatic dependency resolution:
|
|
71
126
|
|
|
72
|
-
|
|
127
|
+
<pre><code>```bash :deploy +setup +test +deploy
|
|
128
|
+
echo "Deploying to ${ENVIRONMENT}"
|
|
129
|
+
```
|
|
130
|
+
</code></pre>
|
|
73
131
|
|
|
74
|
-
|
|
132
|
+
<pre><code>```bash :setup
|
|
133
|
+
echo "Setting up environment"
|
|
134
|
+
```
|
|
135
|
+
</code></pre>
|
|
75
136
|
|
|
76
|
-
|
|
137
|
+
<pre><code>```bash :test
|
|
138
|
+
echo "Running tests"
|
|
139
|
+
```
|
|
140
|
+
</code></pre>
|
|
77
141
|
|
|
78
|
-
|
|
142
|
+
## Advanced Usage
|
|
79
143
|
|
|
80
|
-
|
|
144
|
+
### Configuration
|
|
81
145
|
|
|
82
|
-
|
|
146
|
+
```
|
|
147
|
+
# Environment variables
|
|
148
|
+
export MDE_SAVE_EXECUTED_SCRIPT=1
|
|
149
|
+
export MDE_USER_MUST_APPROVE=1
|
|
83
150
|
|
|
84
|
-
|
|
151
|
+
# Configuration file (.mde.yml)
|
|
152
|
+
save_executed_script: true
|
|
153
|
+
user_must_approve: true
|
|
85
154
|
|
|
86
|
-
|
|
155
|
+
# Command line
|
|
156
|
+
mde --save-executed-script 1 --user-must-approve 1
|
|
157
|
+
```
|
|
87
158
|
|
|
88
|
-
|
|
159
|
+
### Script Management
|
|
89
160
|
|
|
90
|
-
|
|
161
|
+
```bash
|
|
162
|
+
mde --save-executed-script 1 # Save executed scripts
|
|
163
|
+
mde --list-recent-scripts # List saved scripts
|
|
164
|
+
mde --select-recent-script # Execute saved script
|
|
165
|
+
mde --save-execution-output 1 # Save execution output
|
|
166
|
+
```
|
|
91
167
|
|
|
92
|
-
|
|
168
|
+
## Block Types Reference
|
|
93
169
|
|
|
94
|
-
|
|
170
|
+
### Shell Blocks
|
|
171
|
+
<pre><code>```bash
|
|
172
|
+
echo "Hello World"
|
|
173
|
+
```
|
|
174
|
+
</code></pre>
|
|
95
175
|
|
|
96
|
-
|
|
176
|
+
### UX Blocks (Interactive Forms)
|
|
177
|
+
<pre><code>```ux
|
|
178
|
+
name: USER_NAME
|
|
179
|
+
prompt: Enter your name
|
|
180
|
+
init: Guest
|
|
181
|
+
```
|
|
182
|
+
</code></pre>
|
|
183
|
+
|
|
184
|
+
<pre><code>```ux
|
|
185
|
+
name: ENVIRONMENT
|
|
186
|
+
allow:
|
|
187
|
+
- development
|
|
188
|
+
- staging
|
|
189
|
+
- production
|
|
190
|
+
act: :allow
|
|
191
|
+
```
|
|
192
|
+
</code></pre>
|
|
97
193
|
|
|
98
|
-
|
|
194
|
+
<pre><code>```ux
|
|
195
|
+
name: CURRENT_DIR
|
|
196
|
+
exec: basename $(pwd)
|
|
197
|
+
transform: :chomp
|
|
198
|
+
```
|
|
199
|
+
</code></pre>
|
|
99
200
|
|
|
100
|
-
|
|
201
|
+
<pre><code>```ux
|
|
202
|
+
name: EMAIL
|
|
203
|
+
prompt: Enter email address
|
|
204
|
+
validate: '(?<local>[^@]+)@(?<domain>[^@]+)'
|
|
205
|
+
transform: '%{local}@%{domain}'
|
|
206
|
+
```
|
|
207
|
+
</code></pre>
|
|
101
208
|
|
|
102
|
-
|
|
209
|
+
### Variable Blocks
|
|
210
|
+
<pre><code>```vars
|
|
211
|
+
DATABASE_URL: postgresql://localhost:5432/myapp
|
|
212
|
+
DEBUG: true
|
|
213
|
+
```
|
|
214
|
+
</code></pre>
|
|
103
215
|
|
|
104
|
-
|
|
216
|
+
### Link Blocks (Cross-Document Navigation)
|
|
217
|
+
<pre><code>```link
|
|
218
|
+
file: next-page.md
|
|
219
|
+
vars:
|
|
220
|
+
current_user: ${USER_NAME}
|
|
221
|
+
```
|
|
222
|
+
</code></pre>
|
|
223
|
+
|
|
224
|
+
### Data Blocks (YAML)
|
|
225
|
+
<pre><code>```yaml
|
|
226
|
+
users:
|
|
227
|
+
- name: John
|
|
228
|
+
role: admin
|
|
229
|
+
- name: Jane
|
|
230
|
+
role: user
|
|
231
|
+
```
|
|
232
|
+
</code></pre>
|
|
105
233
|
|
|
106
|
-
|
|
234
|
+
### Import Directives
|
|
235
|
+
```
|
|
236
|
+
@import template.md USER_NAME=John ENVIRONMENT=production
|
|
237
|
+
```
|
|
107
238
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
239
|
+
### Options Blocks
|
|
240
|
+
<pre><code>```opts :(document_opts)
|
|
241
|
+
user_must_approve: true
|
|
242
|
+
save_executed_script: true
|
|
243
|
+
menu_ux_row_format: 'DEFAULT %{name} = ${%{name}}'
|
|
244
|
+
```
|
|
245
|
+
</code></pre>
|
|
111
246
|
|
|
112
247
|
## Configuration
|
|
113
248
|
|
|
114
249
|
### Environment Variables
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
250
|
+
<pre><code>```bash
|
|
251
|
+
export MDE_SAVE_EXECUTED_SCRIPT=1
|
|
252
|
+
export MDE_USER_MUST_APPROVE=1
|
|
253
|
+
```
|
|
254
|
+
</code></pre>
|
|
119
255
|
|
|
120
256
|
### Configuration Files
|
|
257
|
+
<pre><code>```yaml
|
|
258
|
+
# .mde.yml
|
|
259
|
+
save_executed_script: true
|
|
260
|
+
user_must_approve: true
|
|
261
|
+
menu_with_inherited_lines: true
|
|
262
|
+
```
|
|
263
|
+
</code></pre>
|
|
121
264
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
### Program Arguments
|
|
127
|
-
|
|
128
|
-
* Configuration in command options, e.g. `mde --save-executed-script 1`
|
|
129
|
-
|
|
130
|
-
## Representing boolean values
|
|
131
|
-
|
|
132
|
-
Boolean values expressed as strings are interpreted as:
|
|
133
|
-
| String | Boolean |
|
|
134
|
-
| :---: | :---: |
|
|
135
|
-
| *empty string* | False |
|
|
136
|
-
| `0` | False |
|
|
137
|
-
| `1` | True |
|
|
138
|
-
| *anything else* | True |
|
|
139
|
-
|
|
140
|
-
E.g. `opt1=1` will set option `opt1` to True.
|
|
141
|
-
|
|
142
|
-
Boolean options configured with environment variables:
|
|
143
|
-
- Set to `1` or non-empty value to save executed scripts; empty or `0` to disable saving.
|
|
144
|
-
e.g. `export MDE_SAVE_EXECUTED_SCRIPT=1`
|
|
145
|
-
e.g. `export MDE_SAVE_EXECUTED_SCRIPT=`
|
|
146
|
-
- Specify variable on command line.
|
|
147
|
-
e.g. `MDE_SAVE_EXECUTED_SCRIPT=1 mde`
|
|
265
|
+
### Command Line Options
|
|
266
|
+
```bash
|
|
267
|
+
mde --save-executed-script 1 --user-must-approve 1 --config my-config.yml
|
|
268
|
+
```
|
|
148
269
|
|
|
149
270
|
## Tab Completion
|
|
150
271
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
Append a command to load the completion script to your shell configuration file. `mde` must be executable for the command to be composed correctly.
|
|
154
|
-
|
|
155
|
-
```bash :()
|
|
156
|
-
echo "source $(mde --pwd)/bin/tab_completion.sh" >> ~/.bash_profile
|
|
157
|
-
```
|
|
272
|
+
See [Tab Completion Documentation](docs/tab-completion.md) for installation and usage instructions.
|
|
158
273
|
|
|
159
|
-
|
|
274
|
+
## Example: Interactive Workflow
|
|
160
275
|
|
|
161
|
-
|
|
162
|
-
`mde <...> <prior word> <current word><TAB>`
|
|
276
|
+
This example demonstrates a complete interactive workflow with UX blocks, dependencies, and cross-document navigation:
|
|
163
277
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
278
|
+
### Step 1: User Input
|
|
279
|
+
<pre><code>```ux :user-setup
|
|
280
|
+
name: USER_NAME
|
|
281
|
+
prompt: Enter your name
|
|
282
|
+
init: Guest
|
|
283
|
+
```
|
|
284
|
+
</code></pre>
|
|
285
|
+
|
|
286
|
+
<pre><code>```ux :environment
|
|
287
|
+
name: ENVIRONMENT
|
|
288
|
+
allow:
|
|
289
|
+
- development
|
|
290
|
+
- staging
|
|
291
|
+
- production
|
|
292
|
+
prompt: Select environment
|
|
293
|
+
```
|
|
294
|
+
</code></pre>
|
|
171
295
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
296
|
+
### Step 2: Automated Setup
|
|
297
|
+
Prompts the user for both values and generates output.
|
|
298
|
+
<pre><code>```bash :setup +user-setup +environment
|
|
299
|
+
echo "Setting up for user: ${USER_NAME}"
|
|
300
|
+
echo "Environment: ${ENVIRONMENT}"
|
|
301
|
+
```
|
|
302
|
+
</code></pre>
|
|
303
|
+
|
|
304
|
+
### Step 3: Conditional Logic
|
|
305
|
+
<pre><code>```bash :deploy +setup
|
|
306
|
+
if [ "${ENVIRONMENT}" = "production" ]; then
|
|
307
|
+
echo "Deploying to production with extra safety checks"
|
|
308
|
+
else
|
|
309
|
+
echo "Deploying to ${ENVIRONMENT}"
|
|
310
|
+
fi
|
|
311
|
+
```
|
|
312
|
+
</code></pre>
|
|
313
|
+
|
|
314
|
+
### Step 4: Cross-Document Navigation
|
|
315
|
+
<pre><code>```link
|
|
316
|
+
file: next-workflow.md
|
|
317
|
+
vars:
|
|
318
|
+
user: ${USER_NAME}
|
|
319
|
+
env: ${ENVIRONMENT}
|
|
320
|
+
```
|
|
321
|
+
</code></pre>
|
|
181
322
|
|
|
182
|
-
|
|
323
|
+
# Testing
|
|
183
324
|
|
|
184
|
-
|
|
325
|
+
## Docker Testing Environment
|
|
185
326
|
|
|
186
|
-
|
|
187
|
-
export TIME=early
|
|
188
|
-
```
|
|
327
|
+
For a complete testing environment with all dependencies, use the Docker testing container:
|
|
189
328
|
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
|
|
329
|
+
```bash
|
|
330
|
+
# Build the test environment
|
|
331
|
+
docker build -f Dockerfile.test -t markdown-exec-test .
|
|
193
332
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
```
|
|
333
|
+
# Run all tests (RSpec, Minitest, and BATS)
|
|
334
|
+
docker run -it markdown-exec-test bash -c 'bundle exec rake test'
|
|
197
335
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
336
|
+
# Run individual test suites
|
|
337
|
+
docker run -it markdown-exec-test bash -c 'bundle exec rspec' # RSpec only
|
|
338
|
+
docker run -it markdown-exec-test bash -c 'bundle exec rake minitest' # Minitest only
|
|
339
|
+
docker run -it markdown-exec-test bash -c 'bundle exec rake bats' # BATS tests only
|
|
201
340
|
|
|
202
|
-
|
|
203
|
-
|
|
341
|
+
# Enter the container interactively
|
|
342
|
+
docker run --rm -it markdown-exec-test bash
|
|
204
343
|
```
|
|
205
344
|
|
|
206
|
-
|
|
345
|
+
## Local Testing
|
|
207
346
|
|
|
208
|
-
Execute tests for individual libraries
|
|
347
|
+
Execute tests for individual libraries locally:
|
|
209
348
|
|
|
210
349
|
`bundle exec rake minitest`
|
|
211
350
|
|