markdown_exec 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.reek +26 -0
- data/.rubocop.yml +18 -0
- data/CHANGELOG.md +91 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +7 -1
- data/README.md +45 -38
- data/Rakefile +465 -11
- data/bin/tab_completion.sh +16 -36
- data/lib/colorize.rb +64 -0
- data/lib/env.rb +37 -0
- data/lib/globfiles.rb +40 -0
- data/lib/markdown_exec/version.rb +3 -1
- data/lib/markdown_exec.rb +542 -660
- data/lib/menu.yml +293 -0
- data/lib/shared.rb +16 -97
- data/lib/tap.rb +42 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f3c0e2ecc6da4fa81adc0876e9f37180204935fd1b666abccd7584145922d98
|
4
|
+
data.tar.gz: 74534fa3b85c76447dbca1affea96bb31c566826edb6484acfeb14af9ce24de7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48c7a83d8bb1c00f947c87fc9de2c316371e538f7fb4637df0f0a58cb2385cb682e0ba65cdfd9e32f04ba5942022b50baa91dd20db17baa68162c8b531c35ab4
|
7
|
+
data.tar.gz: 1b343974fb86e0ff9a9775d50663ae37ccd3919d047cb9efa4291fd2d7b7fbd7b3f72325965949a11c4c999f2fba1167098452a4a52d1cd0dfd707fdabced800
|
data/.reek
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
detectors:
|
3
|
+
DataClump:
|
4
|
+
enabled: false
|
5
|
+
NilCheck:
|
6
|
+
enabled: false
|
7
|
+
TooManyStatements:
|
8
|
+
enabled: false
|
9
|
+
UtilityFunction:
|
10
|
+
public_methods_only: true
|
11
|
+
ControlParameter:
|
12
|
+
enabled: true
|
13
|
+
DuplicateMethodCall:
|
14
|
+
enabled: false # too strict
|
15
|
+
FeatureEnvy:
|
16
|
+
enabled: false # too strict
|
17
|
+
InstanceVariableAssumption:
|
18
|
+
enabled: true
|
19
|
+
IrresponsibleModule:
|
20
|
+
enabled: true
|
21
|
+
LongParameterList:
|
22
|
+
enabled: true
|
23
|
+
LongYieldList:
|
24
|
+
enabled: true
|
25
|
+
TooManyStatements:
|
26
|
+
enabled: false # too strict
|
data/.rubocop.yml
CHANGED
@@ -6,6 +6,9 @@ AllCops:
|
|
6
6
|
NewCops: enable
|
7
7
|
TargetRubyVersion: 2.6
|
8
8
|
|
9
|
+
Lint/SafeNavigationChain:
|
10
|
+
Enabled: false
|
11
|
+
|
9
12
|
Metrics/AbcSize:
|
10
13
|
Enabled: false
|
11
14
|
|
@@ -30,9 +33,24 @@ Metrics/MethodLength:
|
|
30
33
|
Metrics/PerceivedComplexity:
|
31
34
|
Enabled: false
|
32
35
|
|
36
|
+
Minitest/MultipleAssertions:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Security/YAMLLoad:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Style/CommentedKeyword:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Style/DoubleNegation:
|
46
|
+
Enabled: false
|
47
|
+
|
33
48
|
Style/GlobalVars:
|
34
49
|
Enabled: false
|
35
50
|
|
51
|
+
Style/MixinUsage:
|
52
|
+
Enabled: false
|
53
|
+
|
36
54
|
Style/MultilineBlockChain:
|
37
55
|
Enabled: false
|
38
56
|
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
3
|
## [ToDo]
|
4
|
+
`reek lib/markdown_exec.rb --config .reek`
|
4
5
|
|
5
6
|
- user settings
|
6
7
|
- hidden w , w/o () in names
|
@@ -34,9 +35,96 @@
|
|
34
35
|
|
35
36
|
- [ ] re-exec last script v re-run named block in last script
|
36
37
|
- [ ] repeat to reload last doc and block
|
37
|
-
- [ ] option to
|
38
|
+
- [ ] option to log blended, timeline; stdin, stdout, stderr; labels: prefix and blocks
|
39
|
+
- [ ] ren logged_stdout_filename_prefix to saved_stdout_filename_prefix
|
40
|
+
- [ ] ignore '#' in fenced code blocks
|
38
41
|
|
39
|
-
|
42
|
+
- [ ] write named block, can be included
|
43
|
+
- [ ] file type per block type
|
44
|
+
- [ ] file name per block name or specified in quotes ("")
|
45
|
+
- [ ] overwrite-rules for writing blocks
|
46
|
+
- [ ] erase-rules for written blocks
|
47
|
+
- [ ] files to create named at top of script to execute; written prior to start of script
|
48
|
+
|
49
|
+
- [ ] tab completion example ascii demo
|
50
|
+
|
51
|
+
- [ ] reorder help list
|
52
|
+
|
53
|
+
- [ ] parameters or (env vars) in menu
|
54
|
+
- [ ] config menu or read env vars
|
55
|
+
- [ ] enable/disable script, output saving per file
|
56
|
+
- [ ] keep values between runs so same env vars are not prompted
|
57
|
+
- [ ] move menu data to required file
|
58
|
+
|
59
|
+
- [ ] tab complation for short option names
|
60
|
+
|
61
|
+
- [ ] option to list full menu
|
62
|
+
|
63
|
+
- [ ] task confirmation block option or bash template, env names
|
64
|
+
- [ ] decoration for menu heading items, template?
|
65
|
+
- [ ] configuration block `mde_config` anywhere in file
|
66
|
+
- [ ] configuration block `mde_config` anywhere in folder config file
|
67
|
+
```yaml :(mde_config)```
|
68
|
+
- [x] fix execution stdin, stdout to allow for ask function
|
69
|
+
- [ ] fix execution stdin, stdout to allow for tty-prompt
|
70
|
+
|
71
|
+
## [1.3.0] - 2022-07-16
|
72
|
+
|
73
|
+
### Added
|
74
|
+
|
75
|
+
- Short name `-p` for `--user-must-approve` option
|
76
|
+
Enable/disable pause for user to review and approve script
|
77
|
+
- Automatic wrapping for data in blocks of yaml data eg ` ```yaml `
|
78
|
+
Data is written to the file named in the fenced block heading
|
79
|
+
- Data transformations are embedded in the script at every invocation
|
80
|
+
with arguments to the transformation as stdin and stdout for the `yq` process
|
81
|
+
eg `export fruit_summary=$(yq e '[.fruit.name,.fruit.price]' fruit.yml)`
|
82
|
+
for invocation `%(summarize_fruits <fruit.yml >fruit_summary)`
|
83
|
+
and transformation `[.fruit.name,.fruit.price]`
|
84
|
+
- Option to extract document text and display it as disabled items in-line with the blocks in the selection menu.
|
85
|
+
Add options for constants used in parsing.
|
86
|
+
- [x] yaml processing
|
87
|
+
- ```yaml :(make_fruit_file) >fruit.yml```
|
88
|
+
write to: fruit.yml
|
89
|
+
- ```yq [summarize_fruits] +(make_fruit_file) <fruit.yml =color_price```
|
90
|
+
not included in linear script
|
91
|
+
read from: fruit.yml
|
92
|
+
result into var: color_price instead of stdout
|
93
|
+
- ```bash :show_fruit_yml +(summarize_fruits)```
|
94
|
+
include summarize_fruits
|
95
|
+
output value of var color_price
|
96
|
+
|
97
|
+
### Changed
|
98
|
+
|
99
|
+
- Refactoring
|
100
|
+
- Run-time menu in YAML file.
|
101
|
+
- Tap module initialization
|
102
|
+
|
103
|
+
## [1.2.0] - 2022-06-11
|
104
|
+
|
105
|
+
### Added
|
106
|
+
|
107
|
+
- Options
|
108
|
+
- Display document name in block selection menu
|
109
|
+
- Display headings (levels 1,2,3) in block selection menu
|
110
|
+
- Trap Ctrl-C (SIGTERM) while script is executing.
|
111
|
+
Completes MDE processes such as saving output and reporting results.
|
112
|
+
|
113
|
+
### Changed
|
114
|
+
|
115
|
+
- Refactoring
|
116
|
+
|
117
|
+
## [1.1.1] - 2022-05-25
|
118
|
+
|
119
|
+
### Added
|
120
|
+
|
121
|
+
- Post-install instructions to add tab completions permanently to the shell.
|
122
|
+
|
123
|
+
### Changed
|
124
|
+
|
125
|
+
- Improve handling of threads ending while executing scripts.
|
126
|
+
|
127
|
+
## [1.1.0] - 2022-05-21
|
40
128
|
|
41
129
|
### Added
|
42
130
|
|
@@ -53,14 +141,13 @@
|
|
53
141
|
### Changed
|
54
142
|
|
55
143
|
- Exit option is at top of each menu.
|
56
|
-
- Single-stage tab completion,
|
144
|
+
- Single-stage tab completion, default
|
57
145
|
- Presents matching options when current word starts with `-`
|
58
146
|
- Presents directories and files otherwise.
|
59
147
|
- Two-stage tab completion for option arguments.
|
60
148
|
- When prior word is an option and current word is empty
|
61
149
|
- Presents option type on first tab, eg `.BOOL.` for a boolean option.
|
62
150
|
- Presents option default value on second tab, eg `0` for false.
|
63
|
-
- Use 'bash' shell instead of default
|
64
151
|
- Write STDOUT, STDERR, STDIN in sections to saved output file.
|
65
152
|
|
66
153
|
## [1.0.0] - 2022-04-26
|
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.3.0)
|
5
5
|
clipboard (~> 1.3.6)
|
6
6
|
open3 (~> 0.1.1)
|
7
7
|
optparse (~> 0.1.1)
|
@@ -16,6 +16,7 @@ GEM
|
|
16
16
|
clipboard (1.3.6)
|
17
17
|
erb (2.2.3)
|
18
18
|
cgi
|
19
|
+
kwalify (0.7.2)
|
19
20
|
minitest (5.15.0)
|
20
21
|
open3 (0.1.1)
|
21
22
|
optparse (0.1.1)
|
@@ -26,6 +27,10 @@ GEM
|
|
26
27
|
tty-color (~> 0.5)
|
27
28
|
rainbow (3.1.1)
|
28
29
|
rake (13.0.6)
|
30
|
+
reek (6.1.1)
|
31
|
+
kwalify (~> 0.7.0)
|
32
|
+
parser (~> 3.1.0)
|
33
|
+
rainbow (>= 2.0, < 4.0)
|
29
34
|
regexp_parser (2.2.1)
|
30
35
|
rexml (3.2.5)
|
31
36
|
rubocop (1.26.0)
|
@@ -69,6 +74,7 @@ DEPENDENCIES
|
|
69
74
|
markdown_exec!
|
70
75
|
minitest (~> 5.0)
|
71
76
|
rake (~> 13.0)
|
77
|
+
reek
|
72
78
|
rubocop (~> 1.21)
|
73
79
|
rubocop-minitest
|
74
80
|
rubocop-rake
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ Displays help information.
|
|
49
49
|
|
50
50
|
#### `mde`
|
51
51
|
|
52
|
-
Process `README.md` file in the current folder. Displays all the blocks in the file and allows you to select using [up], [down], and [return].
|
52
|
+
Process `README.md` file in the current folder. Displays all the blocks in the file and allows you to select using [up], [down], and [return].
|
53
53
|
|
54
54
|
#### `mde my.md` or `mde -f my.md`
|
55
55
|
|
@@ -156,15 +156,28 @@ Append a command to load the completion script to your shell configuration file.
|
|
156
156
|
echo "source $(mde --pwd)/bin/tab_completion.sh" >> ~/.bash_profile
|
157
157
|
```
|
158
158
|
|
159
|
+
### Behavior
|
160
|
+
|
161
|
+
Press tab for completions appropriate to the current input.
|
162
|
+
`mde <...> <prior word> <current word><TAB>`
|
163
|
+
|
164
|
+
Completions are calculated based on the current word and the prior word.
|
165
|
+
1. If the current word starts with `-`, present matching options, eg `--version` for the current word `--v`.
|
166
|
+
2. Else, if the current word is empty and the prior word is an option that takes an argument, present the type of the argument, eg `.BOOL.` for the option `--user-must-approve`.
|
167
|
+
3. Else, if the current word is the type of argument, from the rule above, present the default value for the option. e.g. `1` for the type `.BOOL.` for the option `--user-must-approve`.
|
168
|
+
4. Else, if the current word is non-empty, list matching files and folders.
|
169
|
+
|
159
170
|
### Example Completions
|
160
171
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
172
|
+
In the table below, tab is indicated by `!`
|
173
|
+
| Input | Completions |
|
174
|
+
| :--- | :--- |
|
175
|
+
| `mde !` | local files and folders |
|
176
|
+
| `mde -!` | all options |
|
177
|
+
| `mde --!` | all options |
|
178
|
+
| `mde --v!` | `mde --version` |
|
179
|
+
| `mde --user-must-approve !` | `mde --user-must-approve .BOOL.`|
|
180
|
+
| `mde --user-must-approve .BOOL.!` | `mde --user-must-approve 1` |
|
168
181
|
|
169
182
|
## Example Blocks
|
170
183
|
|
@@ -190,41 +203,35 @@ export ACTIVITY=asleep
|
|
190
203
|
echo "$TIME -> $ACTIVITY"
|
191
204
|
```
|
192
205
|
|
206
|
+
``` :sleep
|
207
|
+
sleep 10
|
208
|
+
```
|
209
|
+
|
193
210
|
# License
|
194
211
|
|
195
212
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
196
213
|
|
197
214
|
# Code of Conduct
|
198
215
|
|
199
|
-
Everyone interacting in the MarkdownExec project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
select filename in ${files}; do echo "You selected ${filename}"; break; done
|
216
|
+
Everyone interacting in the MarkdownExec project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/fareedst/markdown_exec/blob/master/CODE_OF_CONDUCT.md).
|
217
|
+
|
218
|
+
|
219
|
+
``` :test_vars +(echo_vars)
|
220
|
+
vars1=$(
|
221
|
+
echo '1'
|
222
|
+
whoami
|
223
|
+
echo '2'
|
224
|
+
pwd
|
225
|
+
echo '3'
|
226
|
+
stat README.md
|
227
|
+
echo '4'
|
228
|
+
/bin/ls
|
229
|
+
echo '5'
|
230
|
+
whoami
|
231
|
+
echo '6'
|
232
|
+
)
|
233
|
+
```
|
218
234
|
|
219
|
-
|
220
|
-
echo $
|
221
|
-
echo 'AA'
|
222
|
-
echo 'name? '
|
223
|
-
read name
|
224
|
-
echo 'type? '
|
225
|
-
read type
|
226
|
-
echo 'BB'
|
227
|
-
echo "name: $name"
|
228
|
-
echo "type: $type"
|
229
|
-
echo 'CC'
|
235
|
+
``` :(echo_vars)
|
236
|
+
echo "vars1: ${vars1:-missing}"
|
230
237
|
```
|