markdown_exec 3.0.5 → 3.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3f36dcdba359857aa80f8888d8eaf61e5d2675952a5809341bd993cf30c9ef1
4
- data.tar.gz: cc753bd25f2b229b6c3d7bab99249c2b6786e4b3efa3ca56c098ff4838f9ad78
3
+ metadata.gz: e90e469ce0209e21b14e2534769a953c7d8122a97e9fe22714e346620e5a3b46
4
+ data.tar.gz: 8edf46cc55bb88b2d8cb32a147ce9c730d7951ec1e87b249f346cb5aa226d836
5
5
  SHA512:
6
- metadata.gz: f982dcfa66c59168f8cdf6b1d9d5fc9af2b946f8d9dc42b4d8af9061bb94758784916f1d2afafe7bb215f60d8588900aff43132a8418199f19abbb1b033087cc
7
- data.tar.gz: a7219bde3d387303ca86ea096dc9fbcb059c028c74d9bff1696d9f6bb2d8b77715e9080aec424e4ea35a53462fe895ea6210e930ab6d6a1129172fd95f6a9312
6
+ metadata.gz: 8da075848dc51de098e42f6f09aaa99914c53604f892c473e9ea834cf99c9e3e9a9fa7e41604991c1d912ff637a186e6e4b5c9dfc3d7d2fbdffc9245262e5c4f
7
+ data.tar.gz: 892adbee4f68a4a1aedaf8aedd10baffa724f31454b31e8384def5eb97f4d5bb06e50f777a33afaa92fb1c1b2fd42c022a405208dbf41ba9d0ac31a0680145f2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.0.6] - 2025-06-07
4
+
5
+ ### Added
6
+
7
+ - Class to interface with ENV variable.
8
+
9
+ ### Changed
10
+
11
+ - Improve the collection of inherited code resulting from the evaluation of blocks.
12
+
3
13
  ## [3.0.5] - 2025-05-23
4
14
 
5
15
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (3.0.5)
4
+ markdown_exec (3.0.6)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load 'test_helper'
4
+
5
+ @test 'act_source' {
6
+ spec_mde_xansi_message_doc_blocks_expect docs/dev/block-type-ux-act-init.md \
7
+ export_act \
8
+ 'allow_echo_edit_exec_allow_allow_allow_allow_allow_allow_false_allow_allow_edit'
9
+ }
10
+
11
+ @test 'init_source' {
12
+ spec_mde_xansi_message_doc_blocks_expect docs/dev/block-type-ux-act-init.md \
13
+ export_init \
14
+ 'allow_allow_allow_allow_allow_default_echo_exec_allow_false_false_1.0.0_allow_false'
15
+ }
16
+
17
+ # bin/bmde docs/dev/block-type-ux-act-init.md --list-blocks-message export_init --list-blocks-type 3 --list-blocks
@@ -10,8 +10,7 @@ load 'test_helper'
10
10
  @test 'inherited lines' {
11
11
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-echo.md \
12
12
  '(menu_with_inherited_lines)' \
13
- 'VAR=markdown_exec_IAB='
14
- # 'VAR=markdown_exec_VAR=markdown_exec_IAB='
13
+ '[[ -z $VAR ]] && VAR=markdown_exec_VAR=markdown_exec_IAB='
15
14
  }
16
15
 
17
16
  @test 'selected block - output of wc includes whitespace' {
@@ -11,7 +11,7 @@ load 'test_helper'
11
11
  @test 'init_source' {
12
12
  spec_mde_xansi_message_doc_blocks_expect docs/dev/block-type-ux-sources.md \
13
13
  export_init \
14
- 'default_exec_echo_allow_false_false'
14
+ 'Guest_exec_echo_allow_false_false'
15
15
  }
16
16
 
17
17
  @test 'act_source' {
@@ -4,5 +4,5 @@ load 'test_helper'
4
4
 
5
5
  @test 'Transformed output of executed commands' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-transform.md \
7
- '_Execution output has a trailing newline._Var0=markdown_exec__00000000 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 0a |markdown_exec.|_0000000e__With validate and transform, output has no newline._Var1=markdown_exec_00000000 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 |markdown_exec|_0000000d__With transform :chomp, output has no newline._Var2=markdown_exec_00000000 6d 61 72 6b 64 6f 77 6e 5f 65 78 65 63 |markdown_exec|_0000000d__With transform :upcase, output is in upper case w/ newline._Var3=MARKDOWN_EXEC__00000000 4d 41 52 4b 44 4f 57 4e 5f 45 58 45 43 0a |MARKDOWN_EXEC.|_0000000e'
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
  }
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load 'test_helper'
4
+
5
+ @test 'Import and require blocks with duplicate names - blocks with same name have different requirements' {
6
+ BATS_OUTPUT_FILTER=A
7
+ BATS_SAFE=_
8
+ spec_mde_args_expect docs/dev/import-conflict-0.md \
9
+ 'u0.0' \
10
+ '_u0.0_d0.0_u0.1_d1.0_u1.1'
11
+ }
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env bats
2
+
3
+ load 'test_helper'
4
+
5
+ # Imported blocks `[du]1.*` appear before principal blocks `[du]0.*` in the code evaluated because the import of `import-duplicates-1.md` is above the `0.*` definitions in the principal file.
6
+
7
+ @test 'Import and require blocks with duplicate names - unique in main 0' {
8
+ BATS_OUTPUT_FILTER=A
9
+ BATS_SAFE=_
10
+ spec_mde_args_expect docs/dev/import-duplicates-0.md \
11
+ 'u0.0' \
12
+ '_d1.0_d1.1_d0.0_d0.1_u0.0'
13
+ }
14
+
15
+ @test 'Import and require blocks with duplicate names - unique in main 1' {
16
+ BATS_OUTPUT_FILTER=A
17
+ BATS_SAFE=_
18
+ spec_mde_args_expect docs/dev/import-duplicates-0.md \
19
+ 'u0.1' \
20
+ '_d1.1_d0.1_u0.1'
21
+ }
22
+
23
+ @test 'Import and require blocks with duplicate names - duplicate 0' {
24
+ BATS_OUTPUT_FILTER=A
25
+ BATS_SAFE=_
26
+ spec_mde_args_expect docs/dev/import-duplicates-0.md \
27
+ 'd0' \
28
+ '_d1.0_d1.1_d0.0_d0.1'
29
+ }
30
+
31
+ @test 'Import and require blocks with duplicate names - duplicate 1' {
32
+ BATS_OUTPUT_FILTER=A
33
+ BATS_SAFE=_
34
+ spec_mde_args_expect docs/dev/import-duplicates-0.md \
35
+ 'd1' \
36
+ '_d1.1_d0.1'
37
+ }
38
+
39
+ @test 'Import and require blocks with duplicate names - unique in import 0' {
40
+ BATS_OUTPUT_FILTER=A
41
+ BATS_SAFE=_
42
+ spec_mde_args_expect docs/dev/import-duplicates-0.md \
43
+ 'u1.0' \
44
+ '_d1.0_d1.1_u1.0_d0.0_d0.1'
45
+ }
46
+
47
+ @test 'Import and require blocks with duplicate names - unique in import 1' {
48
+ BATS_OUTPUT_FILTER=A
49
+ BATS_SAFE=_
50
+ spec_mde_args_expect docs/dev/import-duplicates-0.md \
51
+ 'u1.1' \
52
+ '_d1.1_u1.1_d0.1'
53
+ }
@@ -4,5 +4,5 @@ load 'test_helper'
4
4
 
5
5
  @test '' {
6
6
  spec_mde_xansi_dname_doc_blocks_expect docs/dev/variable-expansion-multiline.md \
7
- 'Genus2 = Pongo_Pongo_UX block:_Genus2=Pongo_Pongo_Command substitution:_Genus2 hex: 00000000 50 6f 6e 67 6f 0a 50 6f 6e 67 6f |Pongo.Pongo|_0000000b_Command substitution:_Genus2 text: Pongo_Pongo_Command substitution:_Gemfile_Gemfile.lock_Variable expansion:_Genus2 text: Pongo_Pongo'
7
+ 'Genus2 = Pongo_Pongo_UX block:_Genus2=Pongo_Pongo_Command substitution:_Genus2 hex: 50 6f 6e 67 6f 0a 50 6f 6e 67 6f _Command substitution:_Genus2 text: Pongo_Pongo_Command substitution:_Gemfile_Gemfile.lock_Variable expansion:_Genus2 text: Pongo_Pongo'
8
8
  }
data/bin/bmde CHANGED
@@ -6,12 +6,13 @@ require 'bundler/setup'
6
6
  Bundler.require(:default)
7
7
 
8
8
  require_relative '../lib/markdown_exec'
9
+ require_relative '../lib/env_interface'
9
10
 
10
11
  trace_enabled = false
11
12
 
12
- if ENV['MDE_TRACE_POINT']
13
- trace_output = if ENV['MDE_TRACE_POINT_FILE']
14
- File.open(ENV['MDE_TRACE_POINT_FILE'], 'a')
13
+ if EnvInterface.get('MDE_TRACE_POINT')
14
+ trace_output = if EnvInterface.get('MDE_TRACE_POINT_FILE')
15
+ File.open(EnvInterface.get('MDE_TRACE_POINT_FILE'), 'a')
15
16
  else
16
17
  $stderr
17
18
  end
@@ -0,0 +1,187 @@
1
+ # UX Block Test Cases
2
+
3
+ This document contains test cases for all possible combinations of `init` and `act` behaviors.
4
+
5
+ ## Test Cases
6
+
7
+ ### 1. Explicit Init and Act
8
+
9
+ #### 1.1 Init: allow, Act: allow
10
+ ```ux
11
+ name: ENVIRONMENT
12
+ init: :allow
13
+ allow:
14
+ - development
15
+ - staging
16
+ - production
17
+ act: :allow
18
+ ```
19
+ Behavior:
20
+ - Init: Uses first allowed value (development)
21
+ - Act: Shows menu of allowed values
22
+
23
+ #### 1.2 Init: allow, Act: echo
24
+ ```ux
25
+ name: ENVIRONMENT
26
+ init: :allow
27
+ allow:
28
+ - development
29
+ - staging
30
+ - production
31
+ act: :echo
32
+ echo: "Selected environment: ${ENVIRONMENT}"
33
+ ```
34
+ Behavior:
35
+ - Init: Uses first allowed value (development)
36
+ - Act: Evaluates echo string with current value
37
+
38
+ #### 1.3 Init: allow, Act: edit
39
+ ```ux
40
+ name: ENVIRONMENT
41
+ init: :allow
42
+ allow:
43
+ - development
44
+ - staging
45
+ - production
46
+ act: :edit
47
+ prompt: "Select environment"
48
+ ```
49
+ Behavior:
50
+ - Init: Uses first allowed value (development)
51
+ - Act: Prompts for input
52
+
53
+ #### 1.4 Init: allow, Act: exec
54
+ ```ux
55
+ name: ENVIRONMENT
56
+ init: :allow
57
+ allow:
58
+ - development
59
+ - staging
60
+ - production
61
+ act: :exec
62
+ exec: "echo 'Deploying to ${ENVIRONMENT}'"
63
+ ```
64
+ Behavior:
65
+ - Init: Uses first allowed value (development)
66
+ - Act: Executes command with current value
67
+
68
+ ### 2. Default Init (no init key)
69
+
70
+ #### 2.1 Default Init (allow), Act: allow
71
+ ```ux
72
+ name: ENVIRONMENT
73
+ allow:
74
+ - development
75
+ - staging
76
+ - production
77
+ act: :allow
78
+ ```
79
+ Behavior:
80
+ - Init: Uses first allowed value (development)
81
+ - Act: Shows menu of allowed values
82
+
83
+ #### 2.2 Default Init (default), Act: allow
84
+ ```ux
85
+ name: ENVIRONMENT
86
+ default: development
87
+ act: :allow
88
+ ```
89
+ Behavior:
90
+ - Init: Uses default value (development)
91
+ - Act: Shows menu of allowed values
92
+
93
+ #### 2.3 Default Init (echo), Act: allow
94
+ ```ux
95
+ name: CURRENT_DIR
96
+ echo: $(pwd)
97
+ act: :allow
98
+ ```
99
+ Behavior:
100
+ - Init: Evaluates echo command
101
+ - Act: Shows menu of allowed values
102
+
103
+ #### 2.4 Default Init (exec), Act: allow
104
+ ```ux
105
+ name: CURRENT_DIR
106
+ exec: basename $(pwd)
107
+ act: :allow
108
+ ```
109
+ Behavior:
110
+ - Init: Executes command
111
+ - Act: Shows menu of allowed values
112
+
113
+ ### 3. Default Act (no act key)
114
+
115
+ #### 3.1 Init: allow, Default Act
116
+ ```ux
117
+ name: ENVIRONMENT
118
+ init: :allow
119
+ allow:
120
+ - development
121
+ - staging
122
+ - production
123
+ ```
124
+ Behavior:
125
+ - Init: Uses first allowed value (development)
126
+ - Act: Shows menu of allowed values (defaults to :allow)
127
+
128
+ #### 3.2 Init: false, Default Act
129
+ ```ux
130
+ name: ENVIRONMENT
131
+ init: false
132
+ allow:
133
+ - development
134
+ - staging
135
+ - production
136
+ echo: "Current: ${ENVIRONMENT}"
137
+ ```
138
+ Behavior:
139
+ - Init: No initialization
140
+ - Act: Shows menu of allowed values (defaults to :allow)
141
+
142
+ ### 4. Special Cases
143
+
144
+ #### 4.1 Init: false, Act: false
145
+ ```ux
146
+ name: READONLY_VAR
147
+ init: false
148
+ act: false
149
+ ```
150
+ Behavior:
151
+ - Init: No initialization
152
+ - Act: Cannot be activated
153
+
154
+ #### 4.2 Init: string, Act: allow
155
+ ```ux
156
+ name: VERSION
157
+ init: "1.0.0"
158
+ act: :allow
159
+ allow:
160
+ - "1.0.0"
161
+ - "1.0.1"
162
+ - "1.1.0"
163
+ ```
164
+ Behavior:
165
+ - Init: Uses string value "1.0.0"
166
+ - Act: Shows menu of allowed values
167
+
168
+ #### 4.3 No Init, No Act
169
+ ```ux
170
+ name: ENVIRONMENT
171
+ allow:
172
+ - development
173
+ - staging
174
+ - production
175
+ ```
176
+ Behavior:
177
+ - Init: Uses first allowed value
178
+ - Act: Shows menu of allowed values (defaults to :allow)
179
+
180
+ #### 4.4 No Init, No Act, No Allow
181
+ ```ux
182
+ name: USER_INPUT
183
+ prompt: "Enter value"
184
+ ```
185
+ Behavior:
186
+ - Init: No initialization (defaults to false)
187
+ - Act: Prompts for input (defaults to :edit)
@@ -27,7 +27,6 @@ name: v4
27
27
  / name, default, exec; auto-load executed `basename $(pwd)`
28
28
  / allowed is ignored by exec
29
29
  ```ux :[document_ux_v5]
30
- init: :exec
31
30
  exec: basename $(pwd)
32
31
  name: v5
33
32
  ```
@@ -6,7 +6,7 @@ name: v1
6
6
  / name and default
7
7
  / transform and validate options not applied to default
8
8
  ```ux
9
- default: 11
9
+ init: 11
10
10
  name: v2
11
11
  ```
12
12
  / name and default; auto-load
@@ -17,7 +17,7 @@ name: v3
17
17
  ```
18
18
  / name, default, exec; auto-load static
19
19
  ```ux :[document_ux_v4]
20
- default: 21
20
+ init: 21
21
21
  exec: basename $(pwd)
22
22
  name: v4
23
23
  ```
@@ -21,6 +21,6 @@ echo: $VAR$VAR
21
21
  name: IAB
22
22
  ```
23
23
  ```opts :(document_opts)
24
- menu_with_inherited_lines: true
24
+ menu_with_inherited_lines: false
25
25
  ```
26
26
  @import bats-document-configuration.md
@@ -15,7 +15,6 @@ name: ux1
15
15
  / auto-load block and execute command to calculate
16
16
  / click block to recalculate
17
17
  ```ux :[document_ux2]
18
- act: :exec
19
18
  exec: basename $(pwd)
20
19
  name: ux2
21
20
  ```
@@ -1,8 +1,8 @@
1
1
  / 1. Simple variable display and edit:
2
2
  ```ux
3
+ init: Guest
3
4
  name: USER_NAME
4
5
  prompt: Enter your name
5
- default: Guest
6
6
  ```
7
7
  /Behavior: Displays the USER_NAME variable. When clicked, prompts for input with "Enter your name" and defaults to "Guest" if no input is provided.
8
8
  /
@@ -4,7 +4,7 @@
4
4
  exec: basename $(pwd)
5
5
  name: Var0
6
6
  ```
7
- $(echo -n "$Var0" | hexdump -C)
7
+ $(echo -n "$Var0" | hexdump -v -e '16/1 " %02x"')
8
8
  :::
9
9
  **With validate and transform, output has no newline.**
10
10
  ```ux :[document_ux_transform_1]
@@ -13,7 +13,7 @@ name: Var1
13
13
  transform: '%{name}'
14
14
  validate: (?<name>.+)
15
15
  ```
16
- $(echo -n "$Var1" | hexdump -C)
16
+ $(echo -n "$Var1" | hexdump -v -e '16/1 " %02x"')
17
17
  :::
18
18
  **With transform `:chomp`, output has no newline.**
19
19
  ```ux :[document_ux_transform_2]
@@ -21,7 +21,7 @@ exec: basename $(pwd)
21
21
  name: Var2
22
22
  transform: :chomp
23
23
  ```
24
- $(echo -n "$Var2" | hexdump -C)
24
+ $(echo -n "$Var2" | hexdump -v -e '16/1 " %02x"')
25
25
  :::
26
26
  **With transform `:upcase`, output is in upper case w/ newline.**
27
27
  ```ux :[document_ux_transform_3]
@@ -29,9 +29,10 @@ exec: basename $(pwd)
29
29
  name: Var3
30
30
  transform: :upcase
31
31
  ```
32
- $(echo -n "$Var3" | hexdump -C)
32
+ $(echo -n "$Var3" | hexdump -v -e '16/1 " %02x"')
33
33
  @import bats-document-configuration.md
34
34
  ```opts :(document_opts)
35
35
  divider4_collapsible: false
36
+ screen_width: 80
36
37
  table_center: false
37
38
  ```
@@ -22,5 +22,6 @@ menu_final_divider:
22
22
  menu_for_saved_lines: false
23
23
  menu_initial_divider:
24
24
  menu_vars_set_format:
25
+ screen_width: 80
25
26
  table_center: false
26
27
  ```
@@ -0,0 +1,12 @@
1
+ / Import and require blocks with different requirements.
2
+ ``` :u0.0 +d0
3
+ echo u0.0
4
+ ```
5
+ ``` :d0 +u0.1
6
+ echo d0.0
7
+ ```
8
+ ``` :u0.1
9
+ echo u0.1
10
+ ```
11
+ @import import-conflict-1.md
12
+ @import bats-document-configuration.md
@@ -0,0 +1,7 @@
1
+ / Blocks with duplicate names to be imported.
2
+ ``` :d0 +u1.1
3
+ echo d1.0
4
+ ```
5
+ ``` :u1.1
6
+ echo u1.1
7
+ ```
@@ -0,0 +1,17 @@
1
+ / Import and require blocks with duplicate names.
2
+ / Imported blocks appear first in the code because the import is at the top of the file.
3
+ @import import-duplicates-1.md
4
+ / `d1` is required by `d0` in the import
5
+ ``` :d0
6
+ echo d0.0
7
+ ```
8
+ ``` :d1
9
+ echo d0.1
10
+ ```
11
+ ``` :u0.0 +d0
12
+ echo u0.0
13
+ ```
14
+ ``` :u0.1 +d1
15
+ echo u0.1
16
+ ```
17
+ @import bats-document-configuration.md
@@ -0,0 +1,13 @@
1
+ / Blocks with duplicate names to be imported.
2
+ ``` :d0 +d1
3
+ echo d1.0
4
+ ```
5
+ ``` :d1
6
+ echo d1.1
7
+ ```
8
+ ``` :u1.0 +d0
9
+ echo u1.0
10
+ ```
11
+ ``` :u1.1 +d1
12
+ echo u1.1
13
+ ```
@@ -10,5 +10,6 @@ Run this command to display the inherited code.
10
10
  @import bats-document-configuration.md
11
11
  ```opts :(document_opts)
12
12
  menu_for_saved_lines: false
13
+ screen_width: 80
13
14
  table_center: false
14
15
  ```
@@ -3,4 +3,5 @@ A **document** with no active elements.
3
3
  @import bats-document-configuration.md
4
4
  ```opts :(document_opts)
5
5
  heading1_center: false
6
+ screen_width: 80
6
7
  ```
@@ -14,7 +14,7 @@ readonly: true
14
14
  /
15
15
  / Confirm the string contains a newline `0a`
16
16
  __Command substitution__:
17
- Genus2 hex: $(printf "$Genus2" | hexdump -C)
17
+ Genus2 hex: $(printf "$Genus2" | hexdump -v -e '16/1 " %02x"')
18
18
  /
19
19
  / output with substitution
20
20
  __Command substitution__:
@@ -28,4 +28,7 @@ $(ls -1 G*)
28
28
  __Variable expansion__:
29
29
  Genus2 text: ${Genus2}
30
30
  /
31
+ ```opts :(document_opts)
32
+ screen_width: 80
33
+ ```
31
34
  @import bats-document-configuration.md
@@ -0,0 +1,120 @@
1
+ # UX Block Examples
2
+
3
+ This file contains a collection of unique UX block examples from the documentation.
4
+
5
+ ## Basic Examples
6
+
7
+ ### Simple Variable Display and Edit
8
+ ```ux
9
+ init: Guest
10
+ name: USER_NAME
11
+ prompt: Enter your name
12
+ ```
13
+
14
+ ### Command Output Initialization
15
+ ```ux
16
+ name: CURRENT_DIR
17
+ init: :exec
18
+ exec: basename $(pwd)
19
+ transform: :chomp
20
+ ```
21
+
22
+ ### Echo-based Initialization
23
+ ```ux
24
+ name: SHELL_VERSION
25
+ init: :echo
26
+ echo: $SHELL
27
+ ```
28
+
29
+ ### Selection from Allowed Values
30
+ ```ux
31
+ name: ENVIRONMENT
32
+ allow:
33
+ - development
34
+ - staging
35
+ - production
36
+ prompt: Select environment
37
+ ```
38
+
39
+ ## Validation Examples
40
+
41
+ ### Email Validation
42
+ ```ux
43
+ name: USER_EMAIL
44
+ prompt: Enter email address
45
+ validate: '(?<local>[^@]+)@(?<domain>[^@]+)'
46
+ transform: '%{local}@%{domain}'
47
+ ```
48
+
49
+ ### Version Number Validation
50
+ ```ux
51
+ name: VERSION
52
+ prompt: Enter version number
53
+ validate: '(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)'
54
+ transform: '%{major}.%{minor}.%{patch}'
55
+ ```
56
+
57
+ ## Complex Examples
58
+
59
+ ### Git Branch Selection with Validation
60
+ ```ux
61
+ name: BRANCH_NAME
62
+ init: ":exec"
63
+ exec: "git branch --format='%(refname:short)'"
64
+ validate: "^(?<type>feature|bugfix|hotfix)/(?<ticket>[A-Z]+-\d+)-(?<desc>.+)$"
65
+ transform: "${type}/${ticket}-${desc}"
66
+ prompt: "Select or enter branch name"
67
+ ```
68
+
69
+ ### Environment Configuration with Dependencies
70
+ ```ux
71
+ name: DATABASE_URL
72
+ require:
73
+ - ENVIRONMENT
74
+ - DB_HOST
75
+ - DB_PORT
76
+ format: "postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}"
77
+ ```
78
+
79
+ ### Multi-step Configuration
80
+ ```ux
81
+ name: DEPLOY_CONFIG
82
+ require:
83
+ - ENVIRONMENT
84
+ - VERSION
85
+ init: ":echo"
86
+ echo: "Deploying ${VERSION} to ${ENVIRONMENT}"
87
+ act: ":exec"
88
+ exec: "deploy.sh ${ENVIRONMENT} ${VERSION}"
89
+ ```
90
+
91
+ ### Conditional Initialization
92
+ ```ux
93
+ name: API_KEY
94
+ init: ":allow"
95
+ allow:
96
+ - ${PROD_API_KEY}
97
+ - ${STAGING_API_KEY}
98
+ - ${DEV_API_KEY}
99
+ require:
100
+ - ENVIRONMENT
101
+ ```
102
+
103
+ ### Formatted Output with Validation
104
+ ```ux
105
+ name: PHONE_NUMBER
106
+ prompt: "Enter phone number"
107
+ validate: "(?<country>\d{1,3})(?<area>\d{3})(?<number>\d{7})"
108
+ transform: "+${country} (${area}) ${number}"
109
+ format: "Phone: ${PHONE_NUMBER}"
110
+ ```
111
+
112
+ ### Command Output with Transformation
113
+ ```ux
114
+ name: GIT_STATUS
115
+ init: ":exec"
116
+ exec: "git status --porcelain"
117
+ validate: "(?<status>[AMDR])\s+(?<file>.+)"
118
+ transform: "${status}: ${file}"
119
+ format: "Changes: ${GIT_STATUS}"
120
+ ```