markdown_exec 3.5.1 → 3.5.2
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/.ai-agent-instructions +54 -0
- data/.cursorrules +198 -0
- data/.rubocop.wide.yml +5 -0
- data/.rubocop.yml +7 -2
- data/CHANGELOG.md +12 -1
- data/Gemfile.lock +1 -1
- data/Rakefile +2 -0
- data/ai-principles.md +516 -0
- data/architecture-decisions.md +190 -0
- data/bats/block-hide.bats +1 -1
- data/bats/block-type-bash.bats +5 -5
- data/bats/block-type-link.bats +1 -1
- data/bats/block-type-opts.bats +3 -3
- data/bats/block-type-port.bats +2 -2
- data/bats/block-type-shell-require-ux.bats +2 -2
- data/bats/block-type-ux-allowed.bats +4 -4
- data/bats/block-type-ux-auto.bats +1 -1
- data/bats/block-type-ux-chained.bats +1 -1
- data/bats/block-type-ux-default.bats +1 -1
- data/bats/block-type-ux-echo-hash-transform.bats +1 -1
- data/bats/block-type-ux-echo-hash.bats +2 -2
- data/bats/block-type-ux-echo.bats +3 -3
- data/bats/block-type-ux-exec-hash-transform.bats +1 -1
- data/bats/block-type-ux-exec-hash.bats +2 -2
- data/bats/block-type-ux-exec.bats +1 -1
- data/bats/block-type-ux-force.bats +1 -1
- data/bats/block-type-ux-formats.bats +1 -1
- data/bats/block-type-ux-hidden.bats +1 -1
- data/bats/block-type-ux-invalid.bats +1 -1
- data/bats/block-type-ux-readonly.bats +1 -1
- data/bats/block-type-ux-require-chained.bats +2 -2
- data/bats/block-type-ux-require-context.bats +2 -2
- data/bats/block-type-ux-require.bats +2 -2
- data/bats/block-type-ux-required-variables.bats +1 -1
- data/bats/block-type-ux-row-format.bats +1 -1
- data/bats/block-type-ux-sources.bats +4 -4
- data/bats/block-type-ux-transform.bats +1 -1
- data/bats/block-type-vars.bats +3 -3
- data/bats/border.bats +1 -1
- data/bats/cli.bats +11 -11
- data/bats/command-substitution-options.bats +2 -2
- data/bats/command-substitution.bats +1 -1
- data/bats/document-shell.bats +1 -1
- data/bats/history.bats +5 -5
- data/bats/import-conflict.bats +1 -1
- data/bats/import-directive-line-continuation.bats +1 -1
- data/bats/import-directive-parameter-symbols.bats +1 -1
- data/bats/import-duplicates.bats +6 -6
- data/bats/import-parameter-symbols.bats +1 -1
- data/bats/import-with-text-substitution.bats +1 -1
- data/bats/import.bats +3 -3
- data/bats/indented-block-type-vars.bats +1 -1
- data/bats/indented-multi-line-output.bats +1 -1
- data/bats/line-decor-dynamic.bats +1 -1
- data/bats/line-wrapping.bats +1 -1
- data/bats/load-vars-state-demo.bats +4 -4
- data/bats/markup.bats +4 -4
- data/bats/mde.bats +4 -4
- data/bats/option-expansion.bats +1 -1
- data/bats/options-collapse.bats +4 -4
- data/bats/options.bats +47 -17
- data/bats/plain.bats +1 -1
- data/bats/publish.bats +2 -2
- data/bats/table-column-truncate.bats +1 -1
- data/bats/table.bats +2 -2
- data/bats/variable-expansion-multiline.bats +1 -1
- data/bats/variable-expansion.bats +6 -6
- data/conversation-template.md +611 -0
- data/docs/block-execution-modes.md +177 -0
- data/docs/block-filtering.md +252 -0
- data/docs/block-naming-patterns.md +210 -0
- data/docs/block-scanning-patterns.md +248 -0
- data/docs/cli-reference.md +370 -0
- data/docs/dev/block-hide.md +1 -1
- data/docs/dev/block-type-ux-transform.md +5 -4
- data/docs/dev/print_bytes.md +3 -0
- data/docs/dev/shebang.md +6 -0
- data/docs/docker-testing.md +5 -0
- data/docs/execution-control.md +384 -0
- data/docs/getting-started.md +209 -0
- data/docs/import-options.md +391 -0
- data/docs/tab-completion.md +7 -0
- data/docs/ux-blocks.md +376 -0
- data/examples/linked1.md +8 -1
- data/implementation-decisions.md +212 -0
- data/lib/cached_nested_file_reader.rb +138 -1
- data/lib/command_result.rb +27 -6
- data/lib/executed_shell_command.rb +512 -0
- data/lib/filter.rb +7 -7
- data/lib/hash_delegator.rb +403 -350
- data/lib/link_history.rb +22 -11
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/mdoc.rb +103 -44
- data/lib/menu.src.yml +110 -83
- data/lib/menu.yml +149 -83
- data/lib/transformed_shell_command.rb +449 -0
- data/lib/wl.rb +15 -0
- data/lib/ww.rb +16 -5
- data/requirements.md +111 -0
- data/semantic-tokens.md +132 -0
- data/tasks.md +69 -0
- metadata +26 -4
- data/docs/ux-blocks-examples.md +0 -120
- data/docs/ux-blocks-init-act.md +0 -100
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# Architecture Decisions
|
|
2
|
+
|
|
3
|
+
**STDD Methodology Version**: 1.0.0
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
This document captures the high-level architectural decisions for your project. All decisions are cross-referenced with requirements using semantic tokens `[REQ:*]` and assigned architecture tokens `[ARCH:*]` for traceability.
|
|
7
|
+
|
|
8
|
+
## 1. Language and Runtime [ARCH:LANGUAGE_SELECTION]
|
|
9
|
+
|
|
10
|
+
### Decision: [Your Language/Runtime Choice]
|
|
11
|
+
**Rationale:**
|
|
12
|
+
- Reason 1
|
|
13
|
+
- Reason 2
|
|
14
|
+
- Reason 3
|
|
15
|
+
|
|
16
|
+
**Alternatives Considered:**
|
|
17
|
+
- Alternative 1: Why it was rejected
|
|
18
|
+
- Alternative 2: Why it was rejected
|
|
19
|
+
|
|
20
|
+
## 2. Project Structure [ARCH:PROJECT_STRUCTURE]
|
|
21
|
+
|
|
22
|
+
### Decision: [Your Project Structure]
|
|
23
|
+
```
|
|
24
|
+
project-root/
|
|
25
|
+
├── src/ # Source code
|
|
26
|
+
├── tests/ # Test files
|
|
27
|
+
├── docs/ # Documentation
|
|
28
|
+
└── config/ # Configuration files
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Rationale:**
|
|
32
|
+
- Clear separation of concerns
|
|
33
|
+
- Standard project layout
|
|
34
|
+
- Testable components
|
|
35
|
+
|
|
36
|
+
## 3. Core Architecture Decision [ARCH:EXAMPLE_DECISION] [REQ:EXAMPLE_FEATURE]
|
|
37
|
+
|
|
38
|
+
### Decision: [Your Architecture Choice]
|
|
39
|
+
**Rationale:**
|
|
40
|
+
- Matches requirement [REQ:EXAMPLE_FEATURE]
|
|
41
|
+
- Provides benefits X, Y, Z
|
|
42
|
+
- Simpler implementation
|
|
43
|
+
|
|
44
|
+
**Alternatives Considered:**
|
|
45
|
+
- Alternative approach: More complex, less maintainable
|
|
46
|
+
|
|
47
|
+
**Implementation:**
|
|
48
|
+
- High-level approach
|
|
49
|
+
- Key components
|
|
50
|
+
- Integration points
|
|
51
|
+
|
|
52
|
+
## 4. Data Management [ARCH:DATA_MANAGEMENT] [REQ:DATA_REQUIREMENT]
|
|
53
|
+
|
|
54
|
+
### Decision: [Your Data Management Approach]
|
|
55
|
+
**Rationale:**
|
|
56
|
+
- Reason 1
|
|
57
|
+
- Reason 2
|
|
58
|
+
|
|
59
|
+
**Implementation:**
|
|
60
|
+
- Storage approach
|
|
61
|
+
- Data access patterns
|
|
62
|
+
- Consistency model
|
|
63
|
+
|
|
64
|
+
## 5. Error Handling Strategy [ARCH:ERROR_HANDLING] [REQ:ERROR_HANDLING]
|
|
65
|
+
|
|
66
|
+
### Decision: [Your Error Handling Approach]
|
|
67
|
+
**Rationale:**
|
|
68
|
+
- Idiomatic for chosen language/framework
|
|
69
|
+
- Clear error propagation
|
|
70
|
+
- Easy to test
|
|
71
|
+
|
|
72
|
+
**Pattern:**
|
|
73
|
+
- Error types
|
|
74
|
+
- Error propagation
|
|
75
|
+
- Error reporting
|
|
76
|
+
|
|
77
|
+
## 6. Testing Strategy [ARCH:TESTING_STRATEGY]
|
|
78
|
+
|
|
79
|
+
### Decision: [Your Testing Approach]
|
|
80
|
+
**Rationale:**
|
|
81
|
+
- Comprehensive test coverage
|
|
82
|
+
- Fast unit tests
|
|
83
|
+
- Integration tests for end-to-end scenarios
|
|
84
|
+
- Aligns with validation criteria defined in requirements [REQ:*]
|
|
85
|
+
|
|
86
|
+
**Structure:**
|
|
87
|
+
- Unit test organization
|
|
88
|
+
- Integration test organization
|
|
89
|
+
- Test fixtures and utilities
|
|
90
|
+
|
|
91
|
+
**Note**: This testing strategy implements the validation criteria specified in `requirements.md`. Each requirement's validation criteria informs what types of tests are needed (unit, integration, manual verification, etc.).
|
|
92
|
+
|
|
93
|
+
## 7. Dependency Management [ARCH:DEPENDENCY_MANAGEMENT]
|
|
94
|
+
|
|
95
|
+
### Decision: [Your Dependency Management Approach]
|
|
96
|
+
**Rationale:**
|
|
97
|
+
- Reduce external dependencies
|
|
98
|
+
- Faster builds
|
|
99
|
+
- Fewer security concerns
|
|
100
|
+
|
|
101
|
+
**Allowed Dependencies:**
|
|
102
|
+
- Standard library only (or minimal external dependencies)
|
|
103
|
+
- Consider external packages only if standard library is insufficient
|
|
104
|
+
|
|
105
|
+
## 8. Build and Distribution [ARCH:BUILD_DISTRIBUTION]
|
|
106
|
+
|
|
107
|
+
### Decision: [Your Build and Distribution Approach]
|
|
108
|
+
**Rationale:**
|
|
109
|
+
- Easy deployment
|
|
110
|
+
- No runtime dependencies
|
|
111
|
+
- Cross-platform support
|
|
112
|
+
|
|
113
|
+
**Build Targets:**
|
|
114
|
+
- Platform 1
|
|
115
|
+
- Platform 2
|
|
116
|
+
- Platform 3
|
|
117
|
+
|
|
118
|
+
## 9. Code Organization Principles [ARCH:CODE_ORGANIZATION]
|
|
119
|
+
|
|
120
|
+
### Decision: [Your Code Organization Approach]
|
|
121
|
+
**Rationale:**
|
|
122
|
+
- Testable components
|
|
123
|
+
- Clear responsibilities
|
|
124
|
+
- Easy to extend
|
|
125
|
+
- Maintainable codebase
|
|
126
|
+
|
|
127
|
+
**Principles:**
|
|
128
|
+
- Each module has a single, clear responsibility
|
|
129
|
+
- Functions are small and focused
|
|
130
|
+
- Interfaces where appropriate for testability
|
|
131
|
+
- Avoid global state where possible
|
|
132
|
+
|
|
133
|
+
## 10. Shebang Line Extraction During Cached Nested Read [ARCH:SHEBANG_EXTRACTION] [REQ:SHEBANG_HIDING]
|
|
134
|
+
|
|
135
|
+
### Decision: Extract shebang lines during the cached nested file read process
|
|
136
|
+
**Rationale:**
|
|
137
|
+
- Matches requirement [REQ:SHEBANG_HIDING] to extract shebang lines during cached nested read
|
|
138
|
+
- Centralizes file processing logic in `CachedNestedFileReader`
|
|
139
|
+
- Ensures consistent behavior across all file reads (including nested imports)
|
|
140
|
+
- Leverages existing file caching mechanism to avoid re-processing
|
|
141
|
+
- Single point of control for shebang handling simplifies maintenance
|
|
142
|
+
|
|
143
|
+
**Alternatives Considered:**
|
|
144
|
+
- Post-processing filter: More complex, requires additional pass over processed lines
|
|
145
|
+
- Separate shebang extraction pass: Less efficient, duplicates file reading
|
|
146
|
+
- Per-component filtering: Inconsistent behavior, harder to maintain
|
|
147
|
+
|
|
148
|
+
**Implementation:**
|
|
149
|
+
- Modify `CachedNestedFileReader#readlines` to detect and filter shebang lines inline during segment reading
|
|
150
|
+
- Shebang detection: Lines starting with `#!` at the beginning of file content (first line, index 0)
|
|
151
|
+
- Filtering occurs before segments are processed into `NestedLine` objects, improving efficiency
|
|
152
|
+
- Filtering controlled by CLI option stored as instance variable `@hide_shebang` in `CachedNestedFileReader`
|
|
153
|
+
- Apply filtering recursively to nested imports (same instance variable used in recursive calls)
|
|
154
|
+
|
|
155
|
+
**Integration Points:**
|
|
156
|
+
- `CachedNestedFileReader` receives option via `hide_shebang` parameter during initialization
|
|
157
|
+
- Option stored as `@hide_shebang` instance variable
|
|
158
|
+
- Filtering applied inline during `File.readlines` loop using `next` to skip shebang segments
|
|
159
|
+
- Filtered segments never enter the processing pipeline, ensuring they don't appear in `processed_lines` array
|
|
160
|
+
|
|
161
|
+
## 11. CLI Option Design for Shebang Hiding [ARCH:CLI_OPTION_DESIGN] [REQ:SHEBANG_HIDING]
|
|
162
|
+
|
|
163
|
+
### Decision: Add CLI option `hide_shebang` (default: true) to control shebang line visibility
|
|
164
|
+
**Rationale:**
|
|
165
|
+
- Matches requirement [REQ:SHEBANG_HIDING] for CLI option with default enabled
|
|
166
|
+
- Follows existing CLI option patterns in MDE (see `menu.src.yml`)
|
|
167
|
+
- Default enabled provides better UX (most users don't want shebang in output)
|
|
168
|
+
- Option name `hide_shebang` is clear and descriptive
|
|
169
|
+
- Supports both CLI flag and environment variable (consistent with MDE patterns)
|
|
170
|
+
|
|
171
|
+
**Alternatives Considered:**
|
|
172
|
+
- `show_shebang` (default: false): Less intuitive, requires negation logic
|
|
173
|
+
- `no_hide_shebang`: Double negative is confusing
|
|
174
|
+
- `include_shebang` (default: false): Less clear about default behavior
|
|
175
|
+
|
|
176
|
+
**Implementation:**
|
|
177
|
+
- Add option to `menu.src.yml` with:
|
|
178
|
+
- `opt_name: hide_shebang`
|
|
179
|
+
- `env_var: MDE_HIDE_SHEBANG`
|
|
180
|
+
- `default: true`
|
|
181
|
+
- `procname: val_as_bool`
|
|
182
|
+
- Option accessible via `--hide-shebang` / `--no-hide-shebang` flags
|
|
183
|
+
- Option accessible via `MDE_HIDE_SHEBANG` environment variable
|
|
184
|
+
- Option passed to `CachedNestedFileReader` during initialization or read calls
|
|
185
|
+
|
|
186
|
+
**Integration Points:**
|
|
187
|
+
- `MarkParse#base_options` includes the option
|
|
188
|
+
- `CachedNestedFileReader` receives option value
|
|
189
|
+
- Option value controls filtering behavior in `readlines` method
|
|
190
|
+
|
data/bats/block-hide.bats
CHANGED
data/bats/block-type-bash.bats
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'executes bash block with default shell' {
|
|
6
6
|
BATS_OUTPUT_FILTER=A
|
|
7
7
|
spec_mde_args_expect docs/dev/block-type-bash.md block-with-no-shell-type \
|
|
8
8
|
' species'
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
@test '
|
|
11
|
+
@test 'executes bash block with bash shell' {
|
|
12
12
|
BATS_OUTPUT_FILTER=A
|
|
13
13
|
export MDE_BLOCK_TYPE_DEFAULT=bash
|
|
14
14
|
spec_mde_args_expect docs/dev/block-type-bash.md bash \
|
|
15
15
|
' genus detected_shell: bash'
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
@test '
|
|
18
|
+
@test 'executes bash block with fish shell' {
|
|
19
19
|
skip 'Fish shell is not testable'
|
|
20
20
|
BATS_OUTPUT_FILTER=A
|
|
21
21
|
export MDE_BLOCK_TYPE_DEFAULT=fish
|
|
@@ -23,14 +23,14 @@ load 'test_helper'
|
|
|
23
23
|
' family detected_shell: fish'
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
@test '
|
|
26
|
+
@test 'executes bash block with sh shell' {
|
|
27
27
|
BATS_OUTPUT_FILTER=A
|
|
28
28
|
export MDE_BLOCK_TYPE_DEFAULT=sh
|
|
29
29
|
spec_mde_args_expect docs/dev/block-type-bash.md sh \
|
|
30
30
|
' family detected_shell: sh'
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
@test '
|
|
33
|
+
@test 'executes bash block with nickname' {
|
|
34
34
|
BATS_OUTPUT_FILTER=A
|
|
35
35
|
unset MDE_BLOCK_TYPE_DEFAULT
|
|
36
36
|
spec_mde_args_expect docs/dev/block-type-bash.md \[show-shell-version\] \
|
data/bats/block-type-link.bats
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'sets variable in link block and calls hidden block' {
|
|
6
6
|
# __Exit is required as last block is a Link type
|
|
7
7
|
run_mde_specs_md_args_expect_xansi '[VARIABLE1]' $EXIT_MENU ' VARIABLE1: 1'
|
|
8
8
|
run_mde_specs_md_args_expect_xansi '[VARIABLE1]' '(echo-VARIABLE1)' ' VARIABLE1: 1 VARIABLE1: 1'
|
data/bats/block-type-opts.bats
CHANGED
|
@@ -4,19 +4,19 @@ load 'test_helper'
|
|
|
4
4
|
|
|
5
5
|
# Type: Opts
|
|
6
6
|
|
|
7
|
-
@test '
|
|
7
|
+
@test 'applies opts block before command execution' {
|
|
8
8
|
skip 'Fails because command executes after the block is processed'
|
|
9
9
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-opts.md \
|
|
10
10
|
'BEFORE Species_menu_note_format: "AFTER %{line}" '
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
@test '
|
|
13
|
+
@test 'applies opts block after command execution' {
|
|
14
14
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-opts.md \
|
|
15
15
|
'[decorate-note]' \
|
|
16
16
|
'AFTER Species_menu_note_format: "AFTER %{line}"'
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
@test '
|
|
19
|
+
@test 'shows menu changes from opts block' {
|
|
20
20
|
skip 'Unable to show that menu has changed'
|
|
21
21
|
spec_mde_args_expect docs/dev/block-type-opts.md '[decorate-note]' \
|
|
22
22
|
'AFTER Species'
|
data/bats/block-type-port.bats
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
5
|
# includes output from assignment and from shell block
|
|
6
|
-
@test '
|
|
6
|
+
@test 'exports variable from port block' {
|
|
7
7
|
BATS_OUTPUT_FILTER=A
|
|
8
8
|
spec_mde_args_expect docs/dev/block-type-port.md '[set_vault_1]' show \
|
|
9
9
|
'VAULT = 1 VAULT: 1'
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
@test '
|
|
12
|
+
@test 'reports when exported variable not set' {
|
|
13
13
|
BATS_OUTPUT_FILTER=A
|
|
14
14
|
spec_mde_args_expect docs/dev/block-type-port.md VAULT-is-export show \
|
|
15
15
|
' VAULT: This variable has not been set.'
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test 'initial' {
|
|
5
|
+
@test 'displays initial values before UX block activation' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-shell-require-ux.md \
|
|
7
7
|
'require-a-UX-block__FULL_NAME='
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
@test 'activated' {
|
|
10
|
+
@test 'updates values when UX block activated' {
|
|
11
11
|
# 2025-11-13 add a '.' block to force the display to update
|
|
12
12
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-shell-require-ux.md \
|
|
13
13
|
require-a-UX-block . \
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'loads defaults from constants or first allowed value' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-allowed.md \
|
|
7
7
|
'SPECIES=Pongo tapanuliensis_GENUS=Pongo_FAMILY=_ORDER: Click to select..._Click to select..._YEAR_DISCOVERED=_NAME=Tapanuli Orangutan'
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
@test '
|
|
10
|
+
@test 'loads first allowed value when block executed' {
|
|
11
11
|
skip 'Unable to test the menu presented'
|
|
12
12
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-allowed.md \
|
|
13
13
|
'[FAMILY]' \
|
|
14
14
|
'SPECIES=Pongo tapanuliensis_GENUS=Pongo_FAMILY=Hominidae_Click to select...Click to select..._YEAR_DISCOVERED=_NAME='
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
@test '
|
|
17
|
+
@test 'loads first line from exec output when block executed' {
|
|
18
18
|
skip 'Unable to test the menu presented'
|
|
19
19
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-allowed.md \
|
|
20
20
|
'[YEAR_DISCOVERED]' \
|
|
21
21
|
'SPECIES=Pongo tapanuliensis_GENUS=Pongo_FAMILY=_YEAR_DISCOVERED=2017_NAME='
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
@test '
|
|
24
|
+
@test 'loads first line from echo output when block executed' {
|
|
25
25
|
skip 'Unable to test the menu presented'
|
|
26
26
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-allowed.md \
|
|
27
27
|
'[NAME]' \
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'requires chained read-only UX blocks for computed value' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-chained.md \
|
|
7
7
|
'[SPECIES]' \
|
|
8
8
|
'SPECIES=Pongo tapanuliensis_NAME=Pongo tapanuliensis - Pongo'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'processes each key in echo hash with transform' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo-hash-transform.md \
|
|
7
7
|
'Tapanuli Orangutan_Species: PONGO TAPANULIENSIS_Genus: PONGO_Tapanuli Orangutan_Family: H:Hominidae_Order: P:Primates_Psychedelic Frogfish_Species2: Haccdeeehhiiilnopprsstyy_Genus2: Hehiinoprsty_Family2: Aaadeeiinnnrt'
|
|
8
8
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'automatic block sets multiple variables from echo hash' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo-hash.md \
|
|
7
7
|
'BASENAME=markdown_exec_DOCUMENTS=markdown_OPERATION=exec_Load Tapanuli Orangutan_Load Psychedelic Frogfish_| Variable | Value |_| -------- | ----- |_| Species | |_| Genus | |_| Family | |'
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
@test '
|
|
10
|
+
@test 'activated block sets multiple variables from echo hash' {
|
|
11
11
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo-hash.md \
|
|
12
12
|
'Load Tapanuli Orangutan' \
|
|
13
13
|
'BASENAME=markdown_exec_DOCUMENTS=markdown_OPERATION=exec_Load Tapanuli Orangutan_Load Psychedelic Frogfish_| Variable | Value |_| -------- | ----------------------- |_| Species | Pongo tapanuliensis |_| Genus | Pongo |_| Family | Hominidae |'
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test 'automatic block
|
|
5
|
+
@test 'executes automatic block with default values' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo.md \
|
|
7
7
|
'VAR=markdown_exec_IAB='
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
@test 'inherited lines' {
|
|
10
|
+
@test 'displays inherited lines in menu' {
|
|
11
11
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo.md \
|
|
12
12
|
'(menu_with_inherited_lines)' \
|
|
13
13
|
'[[ -z $VAR ]] && VAR=markdown_exec_VAR=markdown_exec_IAB='
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
@test '
|
|
16
|
+
@test 'includes whitespace in wc output for selected block' {
|
|
17
17
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo.md \
|
|
18
18
|
'(VAR_has_count)' '[IAB_has_count]' \
|
|
19
19
|
'VAR=mmaarrkkddoowwnn__eexxeecc_IAB=mmaarrkkddoowwnn__eexxeeccmmaarrkkddoowwnn__eexxeecc'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'processes each key in exec hash with transform' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-exec-hash-transform.md \
|
|
7
7
|
'Cappuccino Snake_Species_ H Y D R O D Y N A S T E S B I_ 48 59 44 52 4F 44 59 4E 41 53 54 45 53 20 42 49_ C I N C T U S _ _ 43 49 4E 43 54 55 53 0A_Genus_ H Y D R O D Y N A S T E S _ _ 48 59 44 52 4F 44 59 4E 41 53 54 45 53 0A_Family_ C O L U B R I D A E_ 43 4F 4C 55 42 52 49 44 41 45_Order_ S u m t _ _ 53 75 6D 74 0A_Class_ R p i i_ 52 70 69 69_Phylum_ C o d t_ 43 6F 64 74'
|
|
8
8
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'sets variables automatically from exec hash' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-exec-hash.md \
|
|
7
7
|
'A single named variable is set automatically as the_output of the exec string._Common_Name=Yeti Crab__Common_Name=Yeti Crab_ Y e t i C r a b _ _ 59 65 74 69 20 43 72 61 62 0A__Multiple variables are set automatically as the_output of each exec string._One variable is temporary/not stored to inherited lines_but available for calculations within the block._Domain=ukaryota_____D=_Domain=ukaryota_ u k a r y o t a _ _ _ 75 6B 61 72 79 6F 74 61 0A 0A__A single named variable is set interactively as the_output of the exec string._Year_Discovered=_Year_Discovered=_$(hexdump_format "$Year_Discovered")__Multiple variables are set interactively as the_output of the exec string._Genus=_Species=_$(hexdump_format "$Species")_Genus=_$(hexdump_format "$Genus")__A single named variable is set automatically as the_first line of the output of the first element in the echo_hash._Kingdom=Animalia_Kingdom=Animalia_ A n i m a l i a_ 41 6E 69 6D 61 6C 69 61__A single named variable is set automatically as the_first line of the output of the first element in the exec_hash._Class=Malacostraca_Class=Malacostraca_ M a l a c o s t r a c a_ 4D 61 6C 61 63 6F 73 74 72 61 63 61'
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
@test '
|
|
10
|
+
@test 'sets variables interactively from exec hash' {
|
|
11
11
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-exec-hash.md \
|
|
12
12
|
'[Year_Discovered]' \
|
|
13
13
|
'[Genus]' \
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'uses executed command output as initial value' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-exec.md \
|
|
7
7
|
"ux0=_ux1=Unknown_ux2=markdown_exec__ux3=markdown_exec__ux4=Xform: 'markdown'"
|
|
8
8
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
5
|
# UX before VARS although VARS appears first
|
|
6
|
-
@test '
|
|
6
|
+
@test 'forces UX block before VARS block' {
|
|
7
7
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-force.md \
|
|
8
8
|
'Common_Name = Tapanuli Orangutan_ inherited_lines_ - : Common_Name="Tapanuli Orangutan"_ - : Common_Name=Ruby\ Seadragon_Common_Name=Ruby Seadragon_| Common_Name | Ruby Seadragon |'
|
|
9
9
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test 'UX block appearance' {
|
|
5
|
+
@test 'displays UX block appearance by state' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-formats.md \
|
|
7
7
|
'Demonstrate UX block appearance according to its state.__A simple variable declaration._EDIT VAR1 = value1__A selection from predefined options._ALLOW VAR2 = value2__A computed value using command substitution._ECHO VAR3 = Gemfile__An editable computed value._EDIT VAR4 = Gemfile__A command execution with formatted output._EXEC VAR5 = Gemfile___A read-only value._READONLY VAR6 = Gemfile_'
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'requires shell block and another UX block' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-hidden.md \
|
|
7
7
|
'[SPECIES]' \
|
|
8
8
|
'SPECIES=Pongo tapanuliensis_NAME=Pongo tapanuliensis - Pongo'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test 'automatic block
|
|
5
|
+
@test 'reports error when automatic block has invalid YAML' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-invalid.md \
|
|
7
7
|
'_Error: HashDelegator.ItrBlkFrmNstFls:1¤./docs/dev/block-type-ux-invalid.md:1 - --- !ruby/object:NullResult_message: Invalid YAML_data: invalid_ -- -- '
|
|
8
8
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test 'initial value
|
|
5
|
+
@test 'displays initial value and inherited lines' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-require-chained.md \
|
|
7
7
|
'[SPECIES]' \
|
|
8
|
-
'ENTITY = Pongo tapanuliensis,Pongo_ENTITY="Pongo tapanuliensis,Pongo"_SPECIES=Pongo
|
|
8
|
+
'ENTITY = Pongo tapanuliensis,Pongo_ENTITY="Pongo tapanuliensis,Pongo"_SPECIES=Pongo tapanuliensis_GENUS=Pongo_NAME=Pongo tapanuliensis - Pongo_NAME2=Pongo tapanuliensis - Pongo'
|
|
9
9
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test 'initial' {
|
|
5
|
+
@test 'displays initial values before activation' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-require-context.md \
|
|
7
7
|
'Get the common name..._Entity: _ENTITY2: _UX1: _Common name: '
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
@test 'activated' {
|
|
10
|
+
@test 'updates values when block activated' {
|
|
11
11
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-require-context.md \
|
|
12
12
|
\[ux1\] \
|
|
13
13
|
'Get the common name..._Entity: _ENTITY2: Mythical Monkey_UX1: Mythical Monkey_Common name: Mythical Monkey'
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'uses executed command output as initial value' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-require.md \
|
|
7
7
|
'SPECIES=Pongo tapanuliensis_GENUS=Pongo_NAME=Pongo tapanuliensis - Pongo_NAME2=Pongo tapanuliensis - Pongo'
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
@test 'inherited lines' {
|
|
10
|
+
@test 'displays inherited lines in menu' {
|
|
11
11
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-require.md \
|
|
12
12
|
'(menu_with_inherited_lines)' \
|
|
13
13
|
'SPECIES=Pongo\ tapanuliensis_GENUS=Pongo_NAME=Pongo\ tapanuliensis\ -\ Pongo_NAME2=Pongo\ tapanuliensis\ -\ Pongo_SPECIES=Pongo tapanuliensis_GENUS=Pongo_NAME=Pongo tapanuliensis - Pongo_NAME2=Pongo tapanuliensis - Pongo'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'merges row format with prior table' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-row-format.md \
|
|
7
7
|
" | Variable | Value | Prompt |_ | ----------- | --------------------- | ---------------------- |_ | Species | Pongo tapanuliensis | New species? |_ | Name: Genus | Value: Xform: 'Pongo' | Prompt: New genus? |_ | Family | Hominidae | Enter a value: |"
|
|
8
8
|
}
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test 'dname' {
|
|
5
|
+
@test 'displays dname source values' {
|
|
6
6
|
spec_mde_xansi_message_doc_blocks_expect docs/dev/block-type-ux-sources.md \
|
|
7
7
|
dname \
|
|
8
8
|
'USER_NAME=Guest_CURRENT_DIR=markdown_exec_SHELL_VERSION=/bin/bash_ENVIRONMENT=development_USER_EMAIL=_VERSION='
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
@test 'init_source' {
|
|
11
|
+
@test 'displays init_source values' {
|
|
12
12
|
spec_mde_xansi_message_doc_blocks_expect docs/dev/block-type-ux-sources.md \
|
|
13
13
|
export_init \
|
|
14
14
|
'Guest_exec_echo_allow_false_false'
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
@test 'act_source' {
|
|
17
|
+
@test 'displays act_source values' {
|
|
18
18
|
spec_mde_xansi_message_doc_blocks_expect docs/dev/block-type-ux-sources.md \
|
|
19
19
|
export_act \
|
|
20
20
|
'edit_edit_edit_allow_edit_edit'
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
@test 'is_disabled
|
|
23
|
+
@test 'checks is_disabled status' {
|
|
24
24
|
spec_mde_xansi_message_doc_blocks_expect docs/dev/block-type-ux-sources.md \
|
|
25
25
|
is_disabled? \
|
|
26
26
|
'false_false_false_false_false_false'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
load 'test_helper'
|
|
4
4
|
|
|
5
|
-
@test '
|
|
5
|
+
@test 'transforms output of executed commands' {
|
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-transform.md \
|
|
7
7
|
'_Execution output has a trailing newline._Var0=markdown_exec__ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 0a __With validate and transform, output has no newline._Var1=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 __With transform :chomp, output has no newline._Var2=markdown_exec_ 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 __With transform :upcase, output is in upper case w/ newline._Var3=MARKDOWN_EXEC__ 4d 41 52 4b 44 4f 57 4e 5f 45 58 45 43 0a '
|
|
8
8
|
}
|
data/bats/block-type-vars.bats
CHANGED
|
@@ -5,21 +5,21 @@ load 'test_helper'
|
|
|
5
5
|
# Type: Vars
|
|
6
6
|
|
|
7
7
|
# includes output from automatic vars blocks
|
|
8
|
-
@test '
|
|
8
|
+
@test 'loads vars block automatically' {
|
|
9
9
|
BATS_OUTPUT_FILTER=A
|
|
10
10
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-vars.md show \
|
|
11
11
|
'Species = Not specified_Genus = Not specified__Species: Not specified_VAULT: '
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
# includes output from assignment and from shell block
|
|
15
|
-
@test '
|
|
15
|
+
@test 'sets variable in vars block' {
|
|
16
16
|
BATS_OUTPUT_FILTER=A
|
|
17
17
|
spec_mde_args_expect docs/dev/block-type-vars.md '[set_vault_1]' show \
|
|
18
18
|
'Species = Not specified Genus = Not specified VAULT = 1 Species: Not specified VAULT: 1'
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
# handles invalid YAML in block
|
|
22
|
-
@test '
|
|
22
|
+
@test 'handles invalid YAML in vars block' {
|
|
23
23
|
BATS_OUTPUT_FILTER=A
|
|
24
24
|
spec_mde_args_expect docs/dev/block-type-vars.md '[invalid_yaml]' show \
|
|
25
25
|
'Species = Not specified Genus = Not specified Species: Not specified VAULT: '
|