├── .gitignore ├── e2e ├── .gitignore ├── common.py ├── capture_postamble.zsh ├── requirements.txt ├── capture_preamble.zsh ├── test_zsh_pty.py ├── conftest.py ├── test_zsh.py ├── test_bash.py ├── test_fish.py └── test_validation.py ├── pytest.ini ├── .hypothesis ├── examples │ ├── 3829dcef94528797 │ │ └── 1086a78797317d2d │ ├── 3ea86dbcb01b162b │ │ └── 1086a78797317d2d │ ├── 6a13d6a94003c708 │ │ └── 1086a78797317d2d │ ├── 7375ce819d42ab0d │ │ └── 1086a78797317d2d │ ├── 77dae7b8778b88e0 │ │ ├── 1086a78797317d2d │ │ └── bec021b4f368e306 │ ├── 7a02f7143aa5bd0f │ │ └── 1086a78797317d2d │ ├── bb3263574321e5ea │ │ └── 1086a78797317d2d │ ├── c6871e3a81e8b20d │ │ └── 1086a78797317d2d │ └── f7b253aa616ff3a5 │ │ ├── 25be50f1a45836e1 │ │ ├── 74844d13d1d969b6 │ │ └── aad329b8ac08c355 └── unicode_data │ ├── 15.0.0 │ └── charmap.json.gz │ └── 15.1.0 │ └── charmap.json.gz ├── run-e2e-tests.bash ├── examples ├── complgen.usage ├── mygrep.usage └── darcs.usage ├── Cargo.toml ├── src ├── lib.rs ├── scrape.rs └── main.rs ├── .github └── workflows │ └── release.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── README.md └── Cargo.lock /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /venv 3 | -------------------------------------------------------------------------------- /e2e/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | addopts = --ignore=target 3 | -------------------------------------------------------------------------------- /.hypothesis/examples/3829dcef94528797/1086a78797317d2d: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.hypothesis/examples/3ea86dbcb01b162b/1086a78797317d2d: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.hypothesis/examples/6a13d6a94003c708/1086a78797317d2d: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.hypothesis/examples/7375ce819d42ab0d/1086a78797317d2d: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.hypothesis/examples/77dae7b8778b88e0/1086a78797317d2d: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.hypothesis/examples/77dae7b8778b88e0/bec021b4f368e306: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.hypothesis/examples/7a02f7143aa5bd0f/1086a78797317d2d: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.hypothesis/examples/bb3263574321e5ea/1086a78797317d2d: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.hypothesis/examples/c6871e3a81e8b20d/1086a78797317d2d: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /.hypothesis/examples/f7b253aa616ff3a5/25be50f1a45836e1: -------------------------------------------------------------------------------- 1 | " -------------------------------------------------------------------------------- /.hypothesis/examples/f7b253aa616ff3a5/74844d13d1d969b6: -------------------------------------------------------------------------------- 1 | " -------------------------------------------------------------------------------- /.hypothesis/examples/f7b253aa616ff3a5/aad329b8ac08c355: -------------------------------------------------------------------------------- 1 | ?( -------------------------------------------------------------------------------- /.hypothesis/unicode_data/15.0.0/charmap.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaszko/complgen/HEAD/.hypothesis/unicode_data/15.0.0/charmap.json.gz -------------------------------------------------------------------------------- /.hypothesis/unicode_data/15.1.0/charmap.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adaszko/complgen/HEAD/.hypothesis/unicode_data/15.1.0/charmap.json.gz -------------------------------------------------------------------------------- /e2e/common.py: -------------------------------------------------------------------------------- 1 | STRACE_EXPR_GRAMMAR = """ 2 | strace -e ; 3 | ::= [=][!][,]...; 4 | ::= trace | read | write | fault; 5 | ::= %file | file | all; 6 | """ 7 | 8 | LSOF_FILTER_GRAMMAR = """ 9 | lsf -s:[,]...; 10 | ::= TCP | UDP; 11 | ::= [^]; 12 | ::= LISTEN | CLOSED; 13 | """ 14 | -------------------------------------------------------------------------------- /e2e/capture_postamble.zsh: -------------------------------------------------------------------------------- 1 | # signal success! 2 | echo ok') 3 | 4 | zpty -w z "$*"$'\t' 5 | 6 | integer tog=0 7 | # read from the pty, and parse linewise 8 | while zpty -r z; do :; done | while IFS= read -r line; do 9 | if [[ $line == *$'\0\r' ]]; then 10 | (( tog++ )) && return 0 || continue 11 | fi 12 | # display between toggles 13 | (( tog )) && echo -E - $line 14 | done 15 | 16 | return 2 17 | -------------------------------------------------------------------------------- /run-e2e-tests.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | main () { 8 | local this_script_path=$(realpath $0) 9 | local project_dir=$(dirname "$this_script_path") 10 | if [[ ! -d $project_dir/venv ]]; then 11 | python3 -m venv "$project_dir/venv" 12 | "$project_dir/venv/bin/pip" install -r $project_dir/e2e/requirements.txt 13 | fi 14 | $project_dir/venv/bin/pytest --no-header "$@" 15 | } 16 | 17 | main "$@" 18 | -------------------------------------------------------------------------------- /examples/complgen.usage: -------------------------------------------------------------------------------- 1 | complgen