README.md in markdown_exec-1.1.0 vs README.md in markdown_exec-1.1.1
- old
+ new
@@ -154,19 +154,32 @@
```bash :()
echo "source $(mde --pwd)/bin/tab_completion.sh" >> ~/.bash_profile
```
+### Behavior
+
+Press tab for completions appropriate to the current input.
+`mde <...> <prior word> <current word>`
+
+Completions are calculated based on the current word and the prior word.
+1. If the current word starts with `-`, present matching options, eg `--version` for the current word `--v`.
+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`.
+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`.
+4. Else, if the current word is non-empty, list matching files and folders.
+
### Example Completions
-Type tab at end of any of the following commands to see the options.
-- `mde `
-- `mde -`
-- `mde --`
-- `mde --o`
-- `mde --filename my.md -`
-- `mde --filename my.md --`
+In the table below, tab is indicated by `!`
+| Input | Completions |
+| :---: | :---: |
+| `mde !` | local files and folders |
+| `mde -!` | all options |
+| `mde --!` | all options |
+| `mde --v!` | `mde --version` |
+| `mde --user-must-approve !` | `mde --user-must-approve .BOOL.`|
+| `mde --user-must-approve .BOOL.!` | `mde --user-must-approve 1` |
## Example Blocks
When prompted, select either the `awake` or `asleep` block.
@@ -195,36 +208,5 @@
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
# Code of Conduct
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).
-
-###
-i made a tool to help me execute shell commands for ansible, aws, etc.
-
-normally the scripts have a base configuration followed by one or more blocks of commands that must be executed with the base configuration.
-
-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.
-
-i use it regularly to manage deployment processes that require dozens of steps with ease and re-playablity.
-
-the gem is hosted at `https://github.com/fareedst/markdown_exec`.
-
-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.
-
-```bash :test1
-files="$(ls -A .)"
-PS3='?'
-select filename in ${files}; do echo "You selected ${filename}"; break; done
-
-echo "-1"
-echo $0
-echo 'AA'
-echo 'name? '
-read name
-echo 'type? '
-read type
-echo 'BB'
-echo "name: $name"
-echo "type: $type"
-echo 'CC'
-```