markdown_exec 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +49 -11
- data/Gemfile +6 -5
- data/Gemfile.lock +13 -1
- data/README.md +32 -1
- data/Rakefile +35 -1
- data/bin/tab_completion.sh +123 -3
- data/bin/tab_completion.sh.erb +85 -0
- data/lib/markdown_exec/version.rb +3 -2
- data/lib/markdown_exec.rb +594 -203
- data/lib/shared.rb +121 -0
- metadata +18 -10
- data/fixtures/bash1.md +0 -12
- data/fixtures/bash2.md +0 -15
- data/fixtures/exclude1.md +0 -6
- data/fixtures/exclude2.md +0 -12
- data/fixtures/exec1.md +0 -8
- data/fixtures/heading1.md +0 -19
- data/fixtures/sample1.md +0 -9
- data/fixtures/title1.md +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d34e8e9ff237ed338e50c0a03dfbb8c4bbd10e49f1f6ee54f54607ce19b96632
|
4
|
+
data.tar.gz: 54f0ce617360be38233ed974f2cb8d5656e1b9f7671ed9f2ac819c2d66843eb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e14f9203dd2c07b0b0fef5a71ebec355d1e1988c798bc0f5811bf6b97a0f8cd52066ff4dee2372c522248a920add287e3ac8567b3a68d7b885a3ec42266faa30
|
7
|
+
data.tar.gz: b843ddd2e4b7b1b8eda9b4eb19823a32f758a422e27f84a779372e22321f4b16ce3307f51abb45e7bdbf92d14311ceedd110a1999203ffcf03ccb0ffa8f93b7e
|
data/CHANGELOG.md
CHANGED
@@ -2,28 +2,66 @@
|
|
2
2
|
|
3
3
|
## [ToDo]
|
4
4
|
|
5
|
-
- pipe stdin to script
|
6
|
-
- present timestamp, result of last exec for each command
|
7
5
|
- user settings
|
8
6
|
- hidden w , w/o () in names
|
9
7
|
- fix regexp in pathnames
|
10
|
-
|
11
|
-
- read file once to allow for tempdoc stream
|
12
|
-
- include md or blocks file
|
8
|
+
|
9
|
+
- [ ] read file once to allow for tempdoc stream
|
13
10
|
|
14
11
|
- tree display
|
15
12
|
|
16
|
-
- mde options in md file or included file
|
13
|
+
- [ ] mde options, user prompt, in md file or included file
|
14
|
+
|
15
|
+
- [ ] include blocks from local md file
|
16
|
+
|
17
|
+
- execute? yes/no/save/clipboard + record/edit/history
|
18
|
+
|
19
|
+
- [ ] list, view saved output
|
20
|
+
|
21
|
+
- completion
|
22
|
+
- [ ] include blocks in md file
|
23
|
+
|
24
|
+
- [ ] ruby gem data model
|
25
|
+
|
26
|
+
- [ ] extract yaml block into stdout
|
27
|
+
- [ ] extract json block into stdout
|
17
28
|
|
18
|
-
-
|
29
|
+
- [ ] import yaml, json data into environment
|
19
30
|
|
20
|
-
-
|
31
|
+
- [ ] yq filter with imported or named yaml, json data
|
21
32
|
|
22
|
-
-
|
33
|
+
- [ ] yaml dump of options w/ detail
|
23
34
|
|
24
|
-
-
|
35
|
+
- [ ] re-exec last script v re-run named block in last script
|
36
|
+
- [ ] repeat to reload last doc and block
|
37
|
+
- [ ] option to output mixed stdin, stdout, stderr; labels: prefix and blocks
|
38
|
+
|
39
|
+
## [1.0.1] - 2022-05-21
|
40
|
+
|
41
|
+
### Added
|
42
|
+
|
43
|
+
- Display administrative output (command, save files) for executed blocks.
|
44
|
+
- Select base, administrative output as hierarchical output (MDE_DISPLAY_LEVEL).
|
45
|
+
- The user may select Exit, the first option, to quit the program.
|
46
|
+
- The block-selection menu is re-displayed after an approved script is exectued.
|
47
|
+
- Pause for and pass through standard input in scripts executed by the tool.
|
48
|
+
- Options
|
49
|
+
- chmod for saved scripts
|
50
|
+
- shebang for saved scripts
|
51
|
+
- shell for executed and saved scripts
|
52
|
+
|
53
|
+
### Changed
|
25
54
|
|
26
|
-
-
|
55
|
+
- Exit option is at top of each menu.
|
56
|
+
- Single-stage tab completion, defaut
|
57
|
+
- Presents matching options when current word starts with `-`
|
58
|
+
- Presents directories and files otherwise.
|
59
|
+
- Two-stage tab completion for option arguments.
|
60
|
+
- When prior word is an option and current word is empty
|
61
|
+
- Presents option type on first tab, eg `.BOOL.` for a boolean option.
|
62
|
+
- Presents option default value on second tab, eg `0` for false.
|
63
|
+
- Use 'bash' shell instead of default
|
64
|
+
- Write STDOUT, STDERR, STDIN in sections to saved output file.
|
27
65
|
|
28
66
|
## [1.0.0] - 2022-04-26
|
29
67
|
|
data/Gemfile
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
|
-
# Specify your gem's dependencies in markdown_exec.gemspec
|
6
5
|
gemspec
|
7
|
-
|
8
|
-
gem '
|
9
|
-
|
6
|
+
gem 'clipboard'
|
7
|
+
gem 'erb'
|
10
8
|
gem 'minitest', '~> 5.0'
|
11
|
-
|
9
|
+
gem 'rake', '~> 13.0'
|
12
10
|
gem 'rubocop', '~> 1.21'
|
13
11
|
gem 'rubocop-minitest', require: false
|
14
12
|
gem 'rubocop-rake', require: false
|
13
|
+
gem 'shellwords'
|
14
|
+
gem 'uri'
|
15
|
+
gem 'yaml'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
markdown_exec (1.
|
4
|
+
markdown_exec (1.1.0)
|
5
|
+
clipboard (~> 1.3.6)
|
5
6
|
open3 (~> 0.1.1)
|
6
7
|
optparse (~> 0.1.1)
|
7
8
|
tty-prompt (~> 0.23.1)
|
@@ -11,6 +12,10 @@ GEM
|
|
11
12
|
remote: https://rubygems.org/
|
12
13
|
specs:
|
13
14
|
ast (2.4.2)
|
15
|
+
cgi (0.3.2)
|
16
|
+
clipboard (1.3.6)
|
17
|
+
erb (2.2.3)
|
18
|
+
cgi
|
14
19
|
minitest (5.15.0)
|
15
20
|
open3 (0.1.1)
|
16
21
|
optparse (0.1.1)
|
@@ -39,6 +44,7 @@ GEM
|
|
39
44
|
rubocop-rake (0.6.0)
|
40
45
|
rubocop (~> 1.0)
|
41
46
|
ruby-progressbar (1.11.0)
|
47
|
+
shellwords (0.1.0)
|
42
48
|
tty-color (0.6.0)
|
43
49
|
tty-cursor (0.7.1)
|
44
50
|
tty-prompt (0.23.1)
|
@@ -50,6 +56,7 @@ GEM
|
|
50
56
|
wisper (~> 2.0)
|
51
57
|
tty-screen (0.8.1)
|
52
58
|
unicode-display_width (2.1.0)
|
59
|
+
uri (0.11.0)
|
53
60
|
wisper (2.0.1)
|
54
61
|
yaml (0.2.0)
|
55
62
|
|
@@ -57,12 +64,17 @@ PLATFORMS
|
|
57
64
|
arm64-darwin-21
|
58
65
|
|
59
66
|
DEPENDENCIES
|
67
|
+
clipboard
|
68
|
+
erb
|
60
69
|
markdown_exec!
|
61
70
|
minitest (~> 5.0)
|
62
71
|
rake (~> 13.0)
|
63
72
|
rubocop (~> 1.21)
|
64
73
|
rubocop-minitest
|
65
74
|
rubocop-rake
|
75
|
+
shellwords
|
76
|
+
uri
|
77
|
+
yaml
|
66
78
|
|
67
79
|
BUNDLED WITH
|
68
80
|
2.2.32
|
data/README.md
CHANGED
@@ -150,7 +150,7 @@ Boolean options configured with environment variables:
|
|
150
150
|
|
151
151
|
### Install tab completion
|
152
152
|
|
153
|
-
Append a command to load the completion script to your shell configuration file
|
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
154
|
|
155
155
|
```bash :()
|
156
156
|
echo "source $(mde --pwd)/bin/tab_completion.sh" >> ~/.bash_profile
|
@@ -197,3 +197,34 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
197
197
|
# Code of Conduct
|
198
198
|
|
199
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/[USERNAME]/markdown_exec/blob/master/CODE_OF_CONDUCT.md).
|
200
|
+
|
201
|
+
###
|
202
|
+
i made a tool to help me execute shell commands for ansible, aws, etc.
|
203
|
+
|
204
|
+
normally the scripts have a base configuration followed by one or more blocks of commands that must be executed with the base configuration.
|
205
|
+
|
206
|
+
by storing the shell scripts in a markdown file, there is room for both code and explanatory text. the tool provides the interface that names all the code blocks in the file and allows the the user to select and preview the code to execute.
|
207
|
+
|
208
|
+
i use it regularly to manage deployment processes that require dozens of steps with ease and re-playablity.
|
209
|
+
|
210
|
+
the gem is hosted at `https://github.com/fareedst/markdown_exec`.
|
211
|
+
|
212
|
+
please install the Ruby gem with `gem install markdown_exec` and let me know how the installation goes for you. i would like to see if your current deployment scripts can fit into this model.
|
213
|
+
|
214
|
+
```bash :test1
|
215
|
+
files="$(ls -A .)"
|
216
|
+
PS3='?'
|
217
|
+
select filename in ${files}; do echo "You selected ${filename}"; break; done
|
218
|
+
|
219
|
+
echo "-1"
|
220
|
+
echo $0
|
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'
|
230
|
+
```
|
data/Rakefile
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rake/testtask'
|
5
|
+
require 'erb'
|
6
|
+
require 'yaml'
|
7
|
+
|
8
|
+
require_relative 'lib/shared'
|
5
9
|
|
6
10
|
Rake::TestTask.new(:test) do |task|
|
7
11
|
task.libs << 'test'
|
@@ -12,7 +16,7 @@ end
|
|
12
16
|
require 'rubocop/rake_task'
|
13
17
|
|
14
18
|
RuboCop::RakeTask.new do |task|
|
15
|
-
|
19
|
+
task.requires << 'rubocop-minitest'
|
16
20
|
end
|
17
21
|
|
18
22
|
desc 'named task because minitest not included in rubocop tests'
|
@@ -50,3 +54,33 @@ desc 'gem build clean'
|
|
50
54
|
task :clean do
|
51
55
|
system 'rm *.gem'
|
52
56
|
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
BF = 'bin'
|
61
|
+
|
62
|
+
def update_tab_completion(target)
|
63
|
+
words = `#{File.join BF, MarkdownExec::BIN_NAME} --tab-completions`.split("\n")
|
64
|
+
mde_tab_completions = '(' + (words.map { |s| "\"#{s}\"" }).join(' ') + ')'
|
65
|
+
mde_help = `#{File.join BF, MarkdownExec::BIN_NAME} --help`.split("\n")
|
66
|
+
menu_export_yaml = `#{File.join BF, MarkdownExec::BIN_NAME} --menu-export`
|
67
|
+
|
68
|
+
svhs = YAML.load menu_export_yaml # rubocop:disable Security/YAMLLoad
|
69
|
+
svhs.each do |svh|
|
70
|
+
svh[:compreply] = value_for_cli(svh[:default]) if svh[:compreply].nil?
|
71
|
+
end.tap_inspect name: :svhs, format: :yaml
|
72
|
+
|
73
|
+
File.write target, ERB.new(File.read(File.join(BF, 'tab_completion.sh.erb'))).result(binding)
|
74
|
+
end
|
75
|
+
|
76
|
+
desc 'update tab_completion.sh'
|
77
|
+
task :update_tab_completion do
|
78
|
+
update_tab_completion File.join(BF, 'tab_completion.sh')
|
79
|
+
end
|
80
|
+
|
81
|
+
desc 'update tab_completion.sh'
|
82
|
+
task :update_installed_tab_completion do
|
83
|
+
update_tab_completion(fs = File.join(`mde --pwd`.chomp, BF, 'tab_completion.sh'))
|
84
|
+
|
85
|
+
puts `cat #{fs}` ###
|
86
|
+
end
|
data/bin/tab_completion.sh
CHANGED
@@ -4,20 +4,140 @@ __filedirs()
|
|
4
4
|
{
|
5
5
|
local IFS=$'\n'
|
6
6
|
COMPREPLY=( $(compgen -o plusdirs -f -- "${cur}") )
|
7
|
+
# COMPREPLY=( $(compgen -d) $(compgen -f -- "${cur}") )
|
8
|
+
}
|
9
|
+
|
10
|
+
__filedirs_all()
|
11
|
+
{
|
12
|
+
COMPREPLY='.'
|
13
|
+
}
|
14
|
+
|
15
|
+
_mde_echo_version() {
|
16
|
+
echo "1.1.0"
|
7
17
|
}
|
8
18
|
|
9
19
|
_mde() {
|
10
20
|
local cur prev opts
|
11
21
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
12
22
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
13
|
-
|
23
|
+
# printf '%s' "-;${prev}-:${cur}-"
|
14
24
|
|
25
|
+
# current word is an option type
|
26
|
+
# if previous word is an option name
|
27
|
+
# stage 2: replace with option default value
|
28
|
+
#
|
29
|
+
if [[ "${cur}" =~ ^\..+\.$ ]] ; then
|
30
|
+
if [[ ${prev} == -* ]] ; then
|
31
|
+
case $prev in
|
32
|
+
|
33
|
+
--config) COMPREPLY="."; return 0 ;;
|
34
|
+
|
35
|
+
--debug) COMPREPLY="0"; return 0 ;;
|
36
|
+
|
37
|
+
--display-level) COMPREPLY="1"; return 0 ;;
|
38
|
+
|
39
|
+
--filename) COMPREPLY="."; return 0 ;;
|
40
|
+
|
41
|
+
--list-count) COMPREPLY="32"; return 0 ;;
|
42
|
+
|
43
|
+
--logged-stdout-filename-prefix) COMPREPLY="mde"; return 0 ;;
|
44
|
+
|
45
|
+
--output-execution-summary) COMPREPLY="0"; return 0 ;;
|
46
|
+
|
47
|
+
--output-script) COMPREPLY="0"; return 0 ;;
|
48
|
+
|
49
|
+
--output-stdout) COMPREPLY="1"; return 0 ;;
|
50
|
+
|
51
|
+
--path) COMPREPLY="."; return 0 ;;
|
52
|
+
|
53
|
+
--save-executed-script) COMPREPLY="0"; return 0 ;;
|
54
|
+
|
55
|
+
--save-execution-output) COMPREPLY="0"; return 0 ;;
|
56
|
+
|
57
|
+
--saved-script-chmod) COMPREPLY="493"; return 0 ;;
|
58
|
+
|
59
|
+
--saved-script-filename-prefix) COMPREPLY="mde"; return 0 ;;
|
60
|
+
|
61
|
+
--saved-script-folder) COMPREPLY="logs"; return 0 ;;
|
62
|
+
|
63
|
+
--saved-script-glob) COMPREPLY="mde_\*.sh"; return 0 ;;
|
64
|
+
|
65
|
+
--saved-stdout-folder) COMPREPLY="logs"; return 0 ;;
|
66
|
+
|
67
|
+
--saved-stdout-glob) COMPREPLY="mde_\*.out.txt"; return 0 ;;
|
68
|
+
|
69
|
+
--user-must-approve) COMPREPLY="1"; return 0 ;;
|
70
|
+
|
71
|
+
esac
|
72
|
+
fi
|
73
|
+
fi
|
74
|
+
|
75
|
+
# current word is an option name or start of
|
76
|
+
# present matching option names
|
77
|
+
#
|
15
78
|
if [[ ${cur} == -* ]] ; then
|
16
|
-
|
79
|
+
opts=("--list-blocks" "--list-default-env" "--list-default-yaml" "--list-docs" "--list-recent-output" "--list-recent-scripts" "--pwd" "--run-last-script" "--select-recent-output" "--select-recent-script" "--menu-export" "--tab-completions" "--help" "--version" "--exit" "--config" "--debug" "--display-level" "--block-name" "--filename" "--list-count" "--logged-stdout-filename-prefix" "--output-execution-summary" "--output-script" "--output-stdout" "--path" "--save-executed-script" "--save-execution-output" "--saved-script-chmod" "--saved-script-filename-prefix" "--saved-script-folder" "--saved-script-glob" "--saved-stdout-folder" "--saved-stdout-glob" "--user-must-approve")
|
80
|
+
COMPREPLY=( $(compgen -W "$(printf "'%s' " "${opts[@]}")" -- "${cur}") )
|
81
|
+
|
17
82
|
return 0
|
18
83
|
fi
|
19
84
|
|
85
|
+
# no current word
|
86
|
+
# if previous word is an option name
|
87
|
+
# stage 1: present option type
|
88
|
+
#
|
89
|
+
if [[ -z ${cur} ]] ; then
|
90
|
+
case $prev in
|
91
|
+
|
92
|
+
--config) COMPREPLY=".PATH."; return 0 ;;
|
93
|
+
|
94
|
+
--debug) COMPREPLY=".BOOL."; return 0 ;;
|
95
|
+
|
96
|
+
--display-level) COMPREPLY=".INT.0-2."; return 0 ;;
|
97
|
+
|
98
|
+
--block-name) COMPREPLY=".NAME."; return 0 ;;
|
99
|
+
|
100
|
+
--filename) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
101
|
+
|
102
|
+
--list-count) COMPREPLY=".INT.1-."; return 0 ;;
|
103
|
+
|
104
|
+
--logged-stdout-filename-prefix) COMPREPLY=".PREFIX."; return 0 ;;
|
105
|
+
|
106
|
+
--output-execution-summary) COMPREPLY=".BOOL."; return 0 ;;
|
107
|
+
|
108
|
+
--output-script) COMPREPLY=".BOOL."; return 0 ;;
|
109
|
+
|
110
|
+
--output-stdout) COMPREPLY=".BOOL."; return 0 ;;
|
111
|
+
|
112
|
+
--path) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
113
|
+
|
114
|
+
--save-executed-script) COMPREPLY=".BOOL."; return 0 ;;
|
115
|
+
|
116
|
+
--save-execution-output) COMPREPLY=".BOOL."; return 0 ;;
|
117
|
+
|
118
|
+
--saved-script-chmod) COMPREPLY=".INT."; return 0 ;;
|
119
|
+
|
120
|
+
--saved-script-filename-prefix) COMPREPLY=".PREFIX."; return 0 ;;
|
121
|
+
|
122
|
+
--saved-script-folder) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
123
|
+
|
124
|
+
--saved-script-glob) COMPREPLY=".GLOB."; return 0 ;;
|
125
|
+
|
126
|
+
--saved-stdout-folder) COMPREPLY=".RELATIVE_PATH."; return 0 ;;
|
127
|
+
|
128
|
+
--saved-stdout-glob) COMPREPLY=".GLOB."; return 0 ;;
|
129
|
+
|
130
|
+
--user-must-approve) COMPREPLY=".BOOL."; return 0 ;;
|
131
|
+
|
132
|
+
esac
|
133
|
+
fi
|
134
|
+
|
135
|
+
# current word is unrecognized
|
136
|
+
# present matching directory or file names
|
137
|
+
#
|
20
138
|
__filedirs
|
21
139
|
}
|
22
140
|
|
23
|
-
complete -o filenames -F _mde mde
|
141
|
+
complete -o filenames -o nospace -F _mde mde
|
142
|
+
# _mde_echo_version
|
143
|
+
# echo "Updated: 2022-05-21 16:42:10 UTC"
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
__filedirs()
|
4
|
+
{
|
5
|
+
local IFS=$'\n'
|
6
|
+
COMPREPLY=( $(compgen -o plusdirs -f -- "${cur}") )
|
7
|
+
# COMPREPLY=( $(compgen -d) $(compgen -f -- "${cur}") )
|
8
|
+
}
|
9
|
+
|
10
|
+
__filedirs_all()
|
11
|
+
{
|
12
|
+
COMPREPLY='.'
|
13
|
+
}
|
14
|
+
|
15
|
+
_mde_echo_version() {
|
16
|
+
echo "<%= MarkdownExec::VERSION %>"
|
17
|
+
}
|
18
|
+
|
19
|
+
_mde() {
|
20
|
+
local cur prev opts
|
21
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
22
|
+
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
23
|
+
# printf '%s' "-;${prev}-:${cur}-"
|
24
|
+
|
25
|
+
# current word is an option type
|
26
|
+
# if previous word is an option name
|
27
|
+
# stage 2: replace with option default value
|
28
|
+
#
|
29
|
+
if [[ "${cur}" =~ ^\..+\.$ ]] ; then
|
30
|
+
if [[ ${prev} == -* ]] ; then
|
31
|
+
case $prev in
|
32
|
+
<% svhs.each do |svh|
|
33
|
+
svn = svh[:long_name]
|
34
|
+
if svn && svh[:arg_name]
|
35
|
+
svn = '--' + svh[:long_name]
|
36
|
+
if svh[:compreply] == false
|
37
|
+
# nothing
|
38
|
+
elsif svh[:compreply].nil? %>
|
39
|
+
<%= svn + ') __filedirs_all; return 0 ;;' %>
|
40
|
+
<% elsif svh[:compreply].empty?
|
41
|
+
# nothing
|
42
|
+
else %>
|
43
|
+
<%= svn + ') COMPREPLY="' + svh[:compreply] + '"; return 0 ;;' %>
|
44
|
+
<% end
|
45
|
+
end
|
46
|
+
end %>
|
47
|
+
esac
|
48
|
+
fi
|
49
|
+
fi
|
50
|
+
|
51
|
+
# current word is an option name or start of
|
52
|
+
# present matching option names
|
53
|
+
#
|
54
|
+
if [[ ${cur} == -* ]] ; then
|
55
|
+
opts=<%= mde_tab_completions %>
|
56
|
+
COMPREPLY=( $(compgen -W "$(printf "'%s' " "${opts[@]}")" -- "${cur}") )
|
57
|
+
|
58
|
+
return 0
|
59
|
+
fi
|
60
|
+
|
61
|
+
# no current word
|
62
|
+
# if previous word is an option name
|
63
|
+
# stage 1: present option type
|
64
|
+
#
|
65
|
+
if [[ -z ${cur} ]] ; then
|
66
|
+
case $prev in
|
67
|
+
<% svhs.each do |svh|
|
68
|
+
svn = svh[:long_name]
|
69
|
+
if svn && svh[:arg_name]
|
70
|
+
svn = '--' + svh[:long_name] %>
|
71
|
+
<%= svn + ') COMPREPLY=".' + svh[:arg_name] + '."; return 0 ;;' %>
|
72
|
+
<% end
|
73
|
+
end %>
|
74
|
+
esac
|
75
|
+
fi
|
76
|
+
|
77
|
+
# current word is unrecognized
|
78
|
+
# present matching directory or file names
|
79
|
+
#
|
80
|
+
__filedirs
|
81
|
+
}
|
82
|
+
|
83
|
+
complete -o filenames -o nospace -F _mde mde
|
84
|
+
# _mde_echo_version
|
85
|
+
# echo "Updated: <%= Time.now.utc %>"
|