gukhanmun-cli 0.4.0.dev362__py3-none-win_amd64.whl
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.
- gukhanmun_cli/__init__.py +75 -0
- gukhanmun_cli/_bin/gukhanmun-mkdict.exe +0 -0
- gukhanmun_cli/_bin/gukhanmun.exe +4 -0
- gukhanmun_cli/completions/_gukhanmun +86 -0
- gukhanmun_cli/completions/_gukhanmun.ps1 +129 -0
- gukhanmun_cli/completions/gukhanmun.bash +311 -0
- gukhanmun_cli/completions/gukhanmun.fish +72 -0
- gukhanmun_cli/completions/gukhanmun.nu +104 -0
- gukhanmun_cli/completions/manifest.json +14 -0
- gukhanmun_cli/licenses/LICENSE +674 -0
- gukhanmun_cli/licenses/NOTICE.md +106 -0
- gukhanmun_cli/licenses/gukhanmun-loanwords-cdb/ATTRIBUTION.md +23 -0
- gukhanmun_cli/licenses/gukhanmun-loanwords-cdb/LICENSE +696 -0
- gukhanmun_cli/licenses/gukhanmun-loanwords-fst/ATTRIBUTION.md +23 -0
- gukhanmun_cli/licenses/gukhanmun-loanwords-fst/LICENSE +696 -0
- gukhanmun_cli/licenses/gukhanmun-opendict-cdb/ATTRIBUTION.md +28 -0
- gukhanmun_cli/licenses/gukhanmun-opendict-cdb/LICENSE +674 -0
- gukhanmun_cli/licenses/gukhanmun-opendict-fst/ATTRIBUTION.md +28 -0
- gukhanmun_cli/licenses/gukhanmun-opendict-fst/LICENSE +674 -0
- gukhanmun_cli/licenses/gukhanmun-stdict-cdb/ATTRIBUTION.md +35 -0
- gukhanmun_cli/licenses/gukhanmun-stdict-cdb/LICENSE +674 -0
- gukhanmun_cli/licenses/gukhanmun-stdict-fst/ATTRIBUTION.md +35 -0
- gukhanmun_cli/licenses/gukhanmun-stdict-fst/LICENSE +674 -0
- gukhanmun_cli/payload.json +34 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/METADATA +55 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/RECORD +42 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/WHEEL +4 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/entry_points.txt +3 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/LICENSE +674 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/NOTICE.md +106 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-loanwords-cdb/ATTRIBUTION.md +23 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-loanwords-cdb/LICENSE +696 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-loanwords-fst/ATTRIBUTION.md +23 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-loanwords-fst/LICENSE +696 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-opendict-cdb/ATTRIBUTION.md +28 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-opendict-cdb/LICENSE +674 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-opendict-fst/ATTRIBUTION.md +28 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-opendict-fst/LICENSE +674 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-stdict-cdb/ATTRIBUTION.md +35 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-stdict-cdb/LICENSE +674 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-stdict-fst/ATTRIBUTION.md +35 -0
- gukhanmun_cli-0.4.0.dev362.dist-info/licenses/gukhanmun-stdict-fst/LICENSE +674 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Gukhanmun: Launches the bundled standalone command without Python bindings.
|
|
2
|
+
# Copyright (C) 2026 Hong Minhee
|
|
3
|
+
#
|
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
# (at your option) any later version.
|
|
8
|
+
#
|
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
# GNU General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU General Public License
|
|
15
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
|
|
17
|
+
"""Launch the wheel's two commands without dictionary initialization in Python."""
|
|
18
|
+
|
|
19
|
+
import errno
|
|
20
|
+
from importlib.resources import files
|
|
21
|
+
import os
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
import signal
|
|
24
|
+
import subprocess
|
|
25
|
+
import sys
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def main():
|
|
29
|
+
"""Launch the bundled text converter."""
|
|
30
|
+
return _launch("gukhanmun")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def mkdict_main():
|
|
34
|
+
"""Launch the bundled custom dictionary builder."""
|
|
35
|
+
return _launch("gukhanmun-mkdict")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _launch(command):
|
|
39
|
+
"""Replace the POSIX process, or share the Windows console and wait."""
|
|
40
|
+
executable = Path(str(files(__package__).joinpath(
|
|
41
|
+
"_bin", command + (".exe" if os.name == "nt" else "")
|
|
42
|
+
)))
|
|
43
|
+
try:
|
|
44
|
+
# Flush before exec without changing stream encodings or inheritance.
|
|
45
|
+
for stream in (sys.stdout, sys.stderr):
|
|
46
|
+
if stream is not None:
|
|
47
|
+
stream.flush()
|
|
48
|
+
if os.name != "nt":
|
|
49
|
+
# Python ignores these dispositions; a direct native invocation
|
|
50
|
+
# receives the shell defaults. Rust makes its own SIGPIPE choice.
|
|
51
|
+
for name in ("SIGPIPE", "SIGXFZ", "SIGXFSZ"):
|
|
52
|
+
if hasattr(signal, name):
|
|
53
|
+
signal.signal(getattr(signal, name), signal.SIG_DFL)
|
|
54
|
+
os.execv(executable, [command, *sys.argv[1:]])
|
|
55
|
+
previous = {}
|
|
56
|
+
try:
|
|
57
|
+
# Do not use SIG_IGN: on Windows it can disable Ctrl-C in the
|
|
58
|
+
# child. A Python no-op handler keeps parent spawn/wait/reap alive.
|
|
59
|
+
for name in ("SIGINT", "SIGBREAK"):
|
|
60
|
+
if hasattr(signal, name):
|
|
61
|
+
number = getattr(signal, name)
|
|
62
|
+
previous[number] = signal.signal(number, lambda *_: None)
|
|
63
|
+
with subprocess.Popen([str(executable), *sys.argv[1:]]) as child:
|
|
64
|
+
status = child.wait()
|
|
65
|
+
# distlib's console shim passes sys.exit through the CRT's signed
|
|
66
|
+
# integer exit path; preserve all 32 status bits without overflow.
|
|
67
|
+
return status if status < 0x80000000 else status - 0x100000000
|
|
68
|
+
finally:
|
|
69
|
+
for number, handler in previous.items():
|
|
70
|
+
signal.signal(number, handler)
|
|
71
|
+
except OSError as error:
|
|
72
|
+
status = 127 if error.errno == errno.ENOENT else 126
|
|
73
|
+
if sys.stderr is not None:
|
|
74
|
+
print(f"{command}: cannot launch bundled executable: {error}", file=sys.stderr)
|
|
75
|
+
return status
|
|
Binary file
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#compdef gukhanmun
|
|
2
|
+
|
|
3
|
+
autoload -U is-at-least
|
|
4
|
+
|
|
5
|
+
_gukhanmun() {
|
|
6
|
+
typeset -A opt_args
|
|
7
|
+
typeset -a _arguments_options
|
|
8
|
+
local ret=1
|
|
9
|
+
|
|
10
|
+
if is-at-least 5.2; then
|
|
11
|
+
_arguments_options=(-s -S -C)
|
|
12
|
+
else
|
|
13
|
+
_arguments_options=(-s -C)
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
local context curcontext="$curcontext" state line
|
|
17
|
+
_arguments "${_arguments_options[@]}" : \
|
|
18
|
+
'--generate-completion=[Write a shell completion script to stdout and exit without converting. Use shell redirection to save it; cannot be combined with conversion options]:GENERATE_COMPLETION:(bash zsh fish powershell nushell)' \
|
|
19
|
+
'-o+[Output file to write to; writes to standard output when omitted. When the same path as INPUT, the file is replaced atomically]:PATH:_files' \
|
|
20
|
+
'--output=[Output file to write to; writes to standard output when omitted. When the same path as INPUT, the file is replaced atomically]:PATH:_files' \
|
|
21
|
+
'-f+[Input/output format. Inferred from the input file extension when omitted (text/html for .html/.htm, text/markdown for .md/.markdown, text/plain otherwise); falls back to text/plain when reading from standard input. Accepted values\: text/plain, text/html, text/markdown. MIME parameters are accepted for text/markdown; use "text/markdown; variant=GFM" to enable GitHub Flavored Markdown (tables, footnotes, strikethrough, task lists). Unrecognised parameters are ignored]:MIME:' \
|
|
22
|
+
'--format=[Input/output format. Inferred from the input file extension when omitted (text/html for .html/.htm, text/markdown for .md/.markdown, text/plain otherwise); falls back to text/plain when reading from standard input. Accepted values\: text/plain, text/html, text/markdown. MIME parameters are accepted for text/markdown; use "text/markdown; variant=GFM" to enable GitHub Flavored Markdown (tables, footnotes, strikethrough, task lists). Unrecognised parameters are ignored]:MIME:' \
|
|
23
|
+
'-p+[Language variant preset. ko-kr (default) enables the bundled Standard Korean Dictionary (標準國語大辭典), NIKL loanword examples, and the initial sound law (頭音法則). ko-kp leaves loanwords disabled and enables the bundled Open Korean Dictionary 북한어 category and disables the initial sound law, targeting North Korean orthography]:PRESET:(ko-kr ko-kp)' \
|
|
24
|
+
'--preset=[Language variant preset. ko-kr (default) enables the bundled Standard Korean Dictionary (標準國語大辭典), NIKL loanword examples, and the initial sound law (頭音法則). ko-kp leaves loanwords disabled and enables the bundled Open Korean Dictionary 북한어 category and disables the initial sound law, targeting North Korean orthography]:PRESET:(ko-kr ko-kp)' \
|
|
25
|
+
'*-d+[Path to a user-supplied dictionary file (.gukfst or .gukcdb). May be repeated; later dictionaries take priority over earlier ones and over every bundled dictionary]:PATH:_files' \
|
|
26
|
+
'*--dictionary=[Path to a user-supplied dictionary file (.gukfst or .gukcdb). May be repeated; later dictionaries take priority over earlier ones and over every bundled dictionary]:PATH:_files' \
|
|
27
|
+
'*--reference-dictionary=[Additional reference dictionary (.gukfst or .gukcdb). May be repeated]:PATH:_files' \
|
|
28
|
+
'*--loanword-dictionary=[Additional loanword dictionary (.gukfst or .gukcdb). May be repeated]:PATH:_files' \
|
|
29
|
+
'--source-policy=[Cooperation policy; ordered restores the original dictionary-order policy]:SOURCE_POLICY:(reference-authorized reference-first loanword-first ordered)' \
|
|
30
|
+
'-s+[Segmentation strategy for hanja-containing spans. lattice (default) chooses the best path through all dictionary matches. eager greedily takes the longest match at each cursor for lower overhead]:SEGMENTATION:(lattice eager)' \
|
|
31
|
+
'--segmentation=[Segmentation strategy for hanja-containing spans. lattice (default) chooses the best path through all dictionary matches. eager greedily takes the longest match at each cursor for lower overhead]:SEGMENTATION:(lattice eager)' \
|
|
32
|
+
'--numerals=[Numeral conversion strategy for fallback hanja numerals. smart (default) chooses Arabic only for common numeric forms; hangul-phonetic emits hangul annotations; positional-arabic normalizes digit-only runs; additive-arabic normalizes place-marker numerals]:NUMERALS:(hangul-phonetic positional-arabic additive-arabic smart)' \
|
|
33
|
+
'--numeral-strategy=[Numeral conversion strategy for fallback hanja numerals. smart (default) chooses Arabic only for common numeric forms; hangul-phonetic emits hangul annotations; positional-arabic normalizes digit-only runs; additive-arabic normalizes place-marker numerals]:NUMERALS:(hangul-phonetic positional-arabic additive-arabic smart)' \
|
|
34
|
+
'--recovery=[Reader error recovery policy. strict (default) stops at recoverable reader errors. lenient preserves recoverable bad regions and continues; currently this is meaningful for malformed HTML fragments]:RECOVERY:(strict lenient)' \
|
|
35
|
+
'(--punctuation-profile)--punctuation=[Output punctuation preset, independent of the language preset]:PUNCTUATION:(preserve modern traditional traditional-vertical)' \
|
|
36
|
+
'(--punctuation)--punctuation-profile=[JSON punctuation profile, with optional base and per-role overrides]:PATH:_files' \
|
|
37
|
+
'-r+[Controls how hanja annotations appear in the output. hangul-only (default for most presets) emits hangul, adding parenthesized hanja only when disambiguation requires it. hangul-hanja-parens always emits 한글(漢字). hanja-hangul-parens always emits 漢字(한글). ruby-on-hangul and ruby-on-hanja emit a \`ruby\` element with hangul or hanja as the base; scopes that disallow inline markup fall back to parens. original keeps the source hanja, adding a hangul gloss only where required]:RENDERING:(hangul-only hangul-hanja-parens hanja-hangul-parens ruby-on-hangul ruby-on-hanja original)' \
|
|
38
|
+
'--rendering=[Controls how hanja annotations appear in the output. hangul-only (default for most presets) emits hangul, adding parenthesized hanja only when disambiguation requires it. hangul-hanja-parens always emits 한글(漢字). hanja-hangul-parens always emits 漢字(한글). ruby-on-hangul and ruby-on-hanja emit a \`ruby\` element with hangul or hanja as the base; scopes that disallow inline markup fall back to parens. original keeps the source hanja, adding a hangul gloss only where required]:RENDERING:(hangul-only hangul-hanja-parens hanja-hangul-parens ruby-on-hangul ruby-on-hanja original)' \
|
|
39
|
+
'--hanja-variant-set=[Variant set used wherever output keeps hanja]:HANJA_VARIANT_SET:(as-dictionary shinjitai kanxi simplified asahimoji)' \
|
|
40
|
+
'--original-gloss=[Gloss form used by the original renderer. parens (default) emits 漢字(한글); ruby emits a \`ruby\` element with hanja as the base and hangul as the rt gloss, falling back to parens in scopes that disallow inline markup. Only valid with --rendering original]:ORIGINAL_GLOSS:(parens ruby)' \
|
|
41
|
+
'--disambiguation=[Homophone disambiguation context. off disables homophone marking; per-block resets at block scopes; per-section resets at headings; per-document uses one window for the full input]:DISAMBIGUATION:(off per-block per-section per-document)' \
|
|
42
|
+
'--homophone-detection=[Homophone detection strategy. context-local glosses a reading only when a different-meaning homophone appears within the disambiguation window; dictionary-wide also glosses readings shared by other dictionary entries]:HOMOPHONE_DETECTION:(context-local dictionary-wide)' \
|
|
43
|
+
'--first-occurrence=[Context for clearing repeated dictionary presentation requirements. off leaves every occurrence as marked by dictionaries and directives]:FIRST_OCCURRENCE:(off per-block per-section per-document)' \
|
|
44
|
+
'*--directives=[Path to a UTF-8 TSV directive file. The header must be \`action<TAB>pattern<TAB>kind\`; actions are require-hanja, require-hangul, or skip-annotation, and kind is literal or glob. May be repeated]:PATH:_files' \
|
|
45
|
+
'*--require-hanja=[Require visible hanja for a literal hanja form. May be repeated]:HANJA:' \
|
|
46
|
+
'*--require-hanja-glob=[Require visible hanja for hanja forms matched by a CLI glob pattern. The pattern supports \`*\` for any sequence and \`?\` for one character]:PATTERN:' \
|
|
47
|
+
'*--require-hangul=[Require a hangul gloss for a literal hanja form. May be repeated]:HANJA:' \
|
|
48
|
+
'*--require-hangul-glob=[Require a hangul gloss for hanja forms matched by a CLI glob pattern. The pattern supports \`*\` for any sequence and \`?\` for one character]:PATTERN:' \
|
|
49
|
+
'*--skip-annotation=[Collapse annotation rendering for a literal hanja form. May be repeated]:HANJA:' \
|
|
50
|
+
'*--skip-annotation-glob=[Collapse annotation rendering for hanja forms matched by a CLI glob pattern. The pattern supports \`*\` for any sequence and \`?\` for one character]:PATTERN:' \
|
|
51
|
+
'*--html-preserve-class=[Preserve any HTML element whose \`class\` attribute contains the given CSS class. Matching elements and their descendants pass through the converter untouched, in addition to the built-in preserved tags (\`pre\`, \`code\`, \`kbd\`, \`script\`, \`style\`, \`textarea\`) and the inherited \`lang\` rule. May be repeated. Only valid with \`--format text/html\`]:CLASS:' \
|
|
52
|
+
'*--html-preserve-attr=[Preserve any HTML element matching an attribute predicate. Accepts either \`KEY\` (matches when the attribute is present with any value or none, including as a boolean attribute) or \`KEY=VALUE\` (matches when the attribute is present with the exact value). Matched elements and their descendants pass through untouched. May be repeated. Only valid with \`--format text/html\`]:KEY[=VALUE]:' \
|
|
53
|
+
'*--markdown-frontmatter-convert=[Also convert selected YAML front matter values, addressed by a JSONPath expression (for example \`\$.hero.tagline\` or \`\$.hero.actions\[*\].text\`). Each matched string scalar is converted from mixed script to hangul; non-string matches are left untouched. May be repeated. The whole front matter block is reformatted on output, but only matched values change. When given without a leading YAML front matter block, a warning is logged and only the Markdown body is converted. Only valid with \`--format text/markdown\`]:JSONPATH:' \
|
|
54
|
+
'--reference-only[Exclude independent loanword choices, retaining reference-authorized forms. The ordered policy ignores this filter]' \
|
|
55
|
+
'-S[Disable every bundled dictionary selected by the preset]' \
|
|
56
|
+
'--no-bundled-dictionaries[Disable every bundled dictionary selected by the preset]' \
|
|
57
|
+
'(-S --no-bundled-dictionaries --no-loanwords)--loanwords[Enable NIKL loanword examples (default for ko-kr, opt-in for ko-kp)]' \
|
|
58
|
+
'--no-loanwords[Disable only NIKL loanword examples, retaining other preset dictionaries]' \
|
|
59
|
+
'-i[Enable the initial sound law (頭音法則), overriding the preset default]' \
|
|
60
|
+
'--initial-sound-law[Enable the initial sound law (頭音法則), overriding the preset default]' \
|
|
61
|
+
'--dueum[Enable the initial sound law (頭音法則), overriding the preset default]' \
|
|
62
|
+
'-I[Disable the initial sound law (頭音法則), overriding the preset default]' \
|
|
63
|
+
'--no-initial-sound-law[Disable the initial sound law (頭音法則), overriding the preset default]' \
|
|
64
|
+
'--no-dueum[Disable the initial sound law (頭音法則), overriding the preset default]' \
|
|
65
|
+
'--no-collapse-parens[Keep redundant parenthetical reading annotations instead of collapsing them. By default an explicit gloss such as 庫間(곳간) or 곳간(庫間) is collapsed to show both scripts once; this flag preserves the explicit parenthetical text instead]' \
|
|
66
|
+
'-v[Enable debug-level logging to stderr. Equivalent to RUST_LOG=debug when RUST_LOG is not already set. Use RUST_LOG for finer control (e.g. RUST_LOG=trace)]' \
|
|
67
|
+
'--verbose[Enable debug-level logging to stderr. Equivalent to RUST_LOG=debug when RUST_LOG is not already set. Use RUST_LOG for finer control (e.g. RUST_LOG=trace)]' \
|
|
68
|
+
'-h[Print help]' \
|
|
69
|
+
'--help[Print help]' \
|
|
70
|
+
'-V[Print version]' \
|
|
71
|
+
'--version[Print version]' \
|
|
72
|
+
'::input -- Input file to read from; reads from standard input when omitted:_files' \
|
|
73
|
+
&& ret=0
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
(( $+functions[_gukhanmun_commands] )) ||
|
|
77
|
+
_gukhanmun_commands() {
|
|
78
|
+
local commands; commands=()
|
|
79
|
+
_describe -t commands 'gukhanmun commands' commands "$@"
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if [ "$funcstack[1]" = "_gukhanmun" ]; then
|
|
83
|
+
_gukhanmun "$@"
|
|
84
|
+
else
|
|
85
|
+
compdef _gukhanmun gukhanmun
|
|
86
|
+
fi
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Completion metadata and candidates come from the executable's clap schema.
|
|
2
|
+
# Tested with PowerShell 7 and Register-ArgumentCompleter's native interface.
|
|
3
|
+
& {
|
|
4
|
+
$schema = ConvertFrom-Json @'
|
|
5
|
+
[{"names":["--generate-completion"],"takes_value":true,"values":["bash","zsh","fish","powershell","nushell"],"path":false,"help":"Write a shell completion script to stdout and exit without converting. Use shell redirection to save it; cannot be combined with conversion options"},{"names":["-o","--output"],"takes_value":true,"values":[],"path":true,"help":"Output file to write to; writes to standard output when omitted. When the same path as INPUT, the file is replaced atomically"},{"names":["-f","--format"],"takes_value":true,"values":[],"path":false,"help":"Input/output format. Inferred from the input file extension when omitted (text/html for .html/.htm, text/markdown for .md/.markdown, text/plain otherwise); falls back to text/plain when reading from standard input. Accepted values: text/plain, text/html, text/markdown. MIME parameters are accepted for text/markdown; use \"text/markdown; variant=GFM\" to enable GitHub Flavored Markdown (tables, footnotes, strikethrough, task lists). Unrecognised parameters are ignored"},{"names":["-p","--preset"],"takes_value":true,"values":["ko-kr","ko-kp"],"path":false,"help":"Language variant preset. ko-kr (default) enables the bundled Standard Korean Dictionary (標準國語大辭典), NIKL loanword examples, and the initial sound law (頭音法則). ko-kp leaves loanwords disabled and enables the bundled Open Korean Dictionary 북한어 category and disables the initial sound law, targeting North Korean orthography"},{"names":["-d","--dictionary"],"takes_value":true,"values":[],"path":true,"help":"Path to a user-supplied dictionary file (.gukfst or .gukcdb). May be repeated; later dictionaries take priority over earlier ones and over every bundled dictionary"},{"names":["--reference-dictionary"],"takes_value":true,"values":[],"path":true,"help":"Additional reference dictionary (.gukfst or .gukcdb). May be repeated"},{"names":["--loanword-dictionary"],"takes_value":true,"values":[],"path":true,"help":"Additional loanword dictionary (.gukfst or .gukcdb). May be repeated"},{"names":["--source-policy"],"takes_value":true,"values":["reference-authorized","reference-first","loanword-first","ordered"],"path":false,"help":"Cooperation policy; ordered restores the original dictionary-order policy"},{"names":["--reference-only"],"takes_value":false,"values":["true","false"],"path":false,"help":"Exclude independent loanword choices, retaining reference-authorized forms. The ordered policy ignores this filter"},{"names":["-S","--no-bundled-dictionaries"],"takes_value":false,"values":["true","false"],"path":false,"help":"Disable every bundled dictionary selected by the preset"},{"names":["--loanwords"],"takes_value":false,"values":["true","false"],"path":false,"help":"Enable NIKL loanword examples (default for ko-kr, opt-in for ko-kp)"},{"names":["--no-loanwords"],"takes_value":false,"values":["true","false"],"path":false,"help":"Disable only NIKL loanword examples, retaining other preset dictionaries"},{"names":["-s","--segmentation"],"takes_value":true,"values":["lattice","eager"],"path":false,"help":"Segmentation strategy for hanja-containing spans. lattice (default) chooses the best path through all dictionary matches. eager greedily takes the longest match at each cursor for lower overhead"},{"names":["--numerals","--numeral-strategy"],"takes_value":true,"values":["hangul-phonetic","positional-arabic","additive-arabic","smart"],"path":false,"help":"Numeral conversion strategy for fallback hanja numerals. smart (default) chooses Arabic only for common numeric forms; hangul-phonetic emits hangul annotations; positional-arabic normalizes digit-only runs; additive-arabic normalizes place-marker numerals"},{"names":["--recovery"],"takes_value":true,"values":["strict","lenient"],"path":false,"help":"Reader error recovery policy. strict (default) stops at recoverable reader errors. lenient preserves recoverable bad regions and continues; currently this is meaningful for malformed HTML fragments"},{"names":["-i","--initial-sound-law","--dueum"],"takes_value":false,"values":["true","false"],"path":false,"help":"Enable the initial sound law (頭音法則), overriding the preset default"},{"names":["-I","--no-initial-sound-law","--no-dueum"],"takes_value":false,"values":["true","false"],"path":false,"help":"Disable the initial sound law (頭音法則), overriding the preset default"},{"names":["--no-collapse-parens"],"takes_value":false,"values":["true","false"],"path":false,"help":"Keep redundant parenthetical reading annotations instead of collapsing them. By default an explicit gloss such as 庫間(곳간) or 곳간(庫間) is collapsed to show both scripts once; this flag preserves the explicit parenthetical text instead"},{"names":["--punctuation"],"takes_value":true,"values":["preserve","modern","traditional","traditional-vertical"],"path":false,"help":"Output punctuation preset, independent of the language preset"},{"names":["--punctuation-profile"],"takes_value":true,"values":[],"path":true,"help":"JSON punctuation profile, with optional base and per-role overrides"},{"names":["-r","--rendering"],"takes_value":true,"values":["hangul-only","hangul-hanja-parens","hanja-hangul-parens","ruby-on-hangul","ruby-on-hanja","original"],"path":false,"help":"Controls how hanja annotations appear in the output. hangul-only (default for most presets) emits hangul, adding parenthesized hanja only when disambiguation requires it. hangul-hanja-parens always emits 한글(漢字). hanja-hangul-parens always emits 漢字(한글). ruby-on-hangul and ruby-on-hanja emit a `ruby` element with hangul or hanja as the base; scopes that disallow inline markup fall back to parens. original keeps the source hanja, adding a hangul gloss only where required"},{"names":["--hanja-variant-set"],"takes_value":true,"values":["as-dictionary","shinjitai","kanxi","simplified","asahimoji"],"path":false,"help":"Variant set used wherever output keeps hanja"},{"names":["--original-gloss"],"takes_value":true,"values":["parens","ruby"],"path":false,"help":"Gloss form used by the original renderer. parens (default) emits 漢字(한글); ruby emits a `ruby` element with hanja as the base and hangul as the rt gloss, falling back to parens in scopes that disallow inline markup. Only valid with --rendering original"},{"names":["--disambiguation"],"takes_value":true,"values":["off","per-block","per-section","per-document"],"path":false,"help":"Homophone disambiguation context. off disables homophone marking; per-block resets at block scopes; per-section resets at headings; per-document uses one window for the full input"},{"names":["--homophone-detection"],"takes_value":true,"values":["context-local","dictionary-wide"],"path":false,"help":"Homophone detection strategy. context-local glosses a reading only when a different-meaning homophone appears within the disambiguation window; dictionary-wide also glosses readings shared by other dictionary entries"},{"names":["--first-occurrence"],"takes_value":true,"values":["off","per-block","per-section","per-document"],"path":false,"help":"Context for clearing repeated dictionary presentation requirements. off leaves every occurrence as marked by dictionaries and directives"},{"names":["--directives"],"takes_value":true,"values":[],"path":true,"help":"Path to a UTF-8 TSV directive file. The header must be `action<TAB>pattern<TAB>kind`; actions are require-hanja, require-hangul, or skip-annotation, and kind is literal or glob. May be repeated"},{"names":["--require-hanja"],"takes_value":true,"values":[],"path":false,"help":"Require visible hanja for a literal hanja form. May be repeated"},{"names":["--require-hanja-glob"],"takes_value":true,"values":[],"path":false,"help":"Require visible hanja for hanja forms matched by a CLI glob pattern. The pattern supports `*` for any sequence and `?` for one character"},{"names":["--require-hangul"],"takes_value":true,"values":[],"path":false,"help":"Require a hangul gloss for a literal hanja form. May be repeated"},{"names":["--require-hangul-glob"],"takes_value":true,"values":[],"path":false,"help":"Require a hangul gloss for hanja forms matched by a CLI glob pattern. The pattern supports `*` for any sequence and `?` for one character"},{"names":["--skip-annotation"],"takes_value":true,"values":[],"path":false,"help":"Collapse annotation rendering for a literal hanja form. May be repeated"},{"names":["--skip-annotation-glob"],"takes_value":true,"values":[],"path":false,"help":"Collapse annotation rendering for hanja forms matched by a CLI glob pattern. The pattern supports `*` for any sequence and `?` for one character"},{"names":["--html-preserve-class"],"takes_value":true,"values":[],"path":false,"help":"Preserve any HTML element whose `class` attribute contains the given CSS class. Matching elements and their descendants pass through the converter untouched, in addition to the built-in preserved tags (`pre`, `code`, `kbd`, `script`, `style`, `textarea`) and the inherited `lang` rule. May be repeated. Only valid with `--format text/html`"},{"names":["--html-preserve-attr"],"takes_value":true,"values":[],"path":false,"help":"Preserve any HTML element matching an attribute predicate. Accepts either `KEY` (matches when the attribute is present with any value or none, including as a boolean attribute) or `KEY=VALUE` (matches when the attribute is present with the exact value). Matched elements and their descendants pass through untouched. May be repeated. Only valid with `--format text/html`"},{"names":["--markdown-frontmatter-convert"],"takes_value":true,"values":[],"path":false,"help":"Also convert selected YAML front matter values, addressed by a JSONPath expression (for example `$.hero.tagline` or `$.hero.actions[*].text`). Each matched string scalar is converted from mixed script to hangul; non-string matches are left untouched. May be repeated. The whole front matter block is reformatted on output, but only matched values change. When given without a leading YAML front matter block, a warning is logged and only the Markdown body is converted. Only valid with `--format text/markdown`"},{"names":["-v","--verbose"],"takes_value":false,"values":["true","false"],"path":false,"help":"Enable debug-level logging to stderr. Equivalent to RUST_LOG=debug when RUST_LOG is not already set. Use RUST_LOG for finer control (e.g. RUST_LOG=trace)"},{"names":["-h","--help"],"takes_value":false,"values":[],"path":false,"help":"Print help"},{"names":["-V","--version"],"takes_value":false,"values":[],"path":false,"help":"Print version"}]
|
|
6
|
+
'@
|
|
7
|
+
Register-ArgumentCompleter -Native -CommandName gukhanmun -ScriptBlock {
|
|
8
|
+
param($wordToComplete, $commandAst, $cursorPosition)
|
|
9
|
+
|
|
10
|
+
# Ignore arguments after the cursor, including when editing an earlier word.
|
|
11
|
+
$elements = @($commandAst.CommandElements | Where-Object { $_.Extent.StartOffset -lt $cursorPosition })
|
|
12
|
+
$current = $null
|
|
13
|
+
$word = ''
|
|
14
|
+
if ($elements.Count -gt 1 -and $elements[-1].Extent.EndOffset -ge $cursorPosition) {
|
|
15
|
+
$current = $elements[-1]
|
|
16
|
+
$word = $current.Extent.Text.Substring(0, $cursorPosition - $current.Extent.StartOffset)
|
|
17
|
+
}
|
|
18
|
+
# A value-taking short option consumes the remainder of its cluster.
|
|
19
|
+
$resolveShort = {
|
|
20
|
+
param($token)
|
|
21
|
+
if (-not $token.StartsWith('-') -or $token.StartsWith('--')) { return $null }
|
|
22
|
+
for ($index = 1; $index -lt $token.Length; $index++) {
|
|
23
|
+
$name = '-' + $token[$index]
|
|
24
|
+
$option = @($schema | Where-Object { $_.names -ccontains $name })
|
|
25
|
+
if ($option.Count -eq 0) { return $null }
|
|
26
|
+
if ($option[0].takes_value) {
|
|
27
|
+
$prefix = $token.Substring(0, $index + 1)
|
|
28
|
+
$value = $token.Substring($index + 1)
|
|
29
|
+
$attached = $value.Length -gt 0
|
|
30
|
+
if ($value.StartsWith('=')) {
|
|
31
|
+
$prefix += '='
|
|
32
|
+
$value = $value.Substring(1)
|
|
33
|
+
}
|
|
34
|
+
return @{
|
|
35
|
+
Option = $option[0]
|
|
36
|
+
Prefix = $prefix
|
|
37
|
+
Value = $value
|
|
38
|
+
Attached = $attached
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return $null
|
|
43
|
+
}
|
|
44
|
+
$pending = $null
|
|
45
|
+
$terminated = $false
|
|
46
|
+
foreach ($element in $elements | Select-Object -Skip 1) {
|
|
47
|
+
if ($element -eq $current) { break }
|
|
48
|
+
$token = $element.Extent.Text
|
|
49
|
+
if ($token -ceq '--') {
|
|
50
|
+
$terminated = $true
|
|
51
|
+
$pending = $null
|
|
52
|
+
continue
|
|
53
|
+
}
|
|
54
|
+
if ($terminated) { continue }
|
|
55
|
+
if ($null -ne $pending) {
|
|
56
|
+
$pending = $null
|
|
57
|
+
continue
|
|
58
|
+
}
|
|
59
|
+
$option = @($schema | Where-Object { $_.names -ccontains $token })
|
|
60
|
+
if ($option.Count -gt 0 -and $option[0].takes_value) {
|
|
61
|
+
$pending = $option[0]
|
|
62
|
+
} elseif ($option.Count -eq 0) {
|
|
63
|
+
$short = & $resolveShort $token
|
|
64
|
+
if ($null -ne $short -and -not $short.Attached) { $pending = $short.Option }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
$valueOption = $pending
|
|
69
|
+
$prefix = ''
|
|
70
|
+
if (-not $terminated -and $word -match '^([^=]+)=(.*)$') {
|
|
71
|
+
$option = @($schema | Where-Object { $_.names -ccontains $Matches[1] })
|
|
72
|
+
if ($option.Count -gt 0 -and $option[0].takes_value) {
|
|
73
|
+
$valueOption = $option[0]
|
|
74
|
+
$prefix = $Matches[1] + '='
|
|
75
|
+
$word = $Matches[2]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (-not $terminated -and $null -eq $valueOption) {
|
|
79
|
+
$short = & $resolveShort $word
|
|
80
|
+
if ($null -ne $short -and $short.Attached) {
|
|
81
|
+
$valueOption = $short.Option
|
|
82
|
+
$prefix = $short.Prefix
|
|
83
|
+
$word = $short.Value
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if ($null -ne $valueOption) {
|
|
87
|
+
if ($valueOption.values.Count -gt 0) {
|
|
88
|
+
$valuePrefix = $word.Trim("'`"")
|
|
89
|
+
$matched = $false
|
|
90
|
+
foreach ($value in $valueOption.values) {
|
|
91
|
+
if ($value.StartsWith($valuePrefix, [StringComparison]::Ordinal)) {
|
|
92
|
+
$matched = $true
|
|
93
|
+
$candidate = $prefix + $value
|
|
94
|
+
if ($candidate -match '[\s''"]') { $candidate = "'" + $candidate.Replace("'", "''") + "'" }
|
|
95
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
96
|
+
$candidate, $value, 'ParameterValue', $value)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if ($matched) { return }
|
|
100
|
+
} elseif ($valueOption.path) {
|
|
101
|
+
foreach ($file in [System.Management.Automation.CompletionCompleters]::CompleteFilename($word)) {
|
|
102
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
103
|
+
$prefix + $file.CompletionText, $file.ListItemText, $file.ResultType, $file.ToolTip)
|
|
104
|
+
}
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
# An empty pipeline enables PowerShell's filename fallback. Keep the
|
|
108
|
+
# input unchanged when a non-path value has no candidates. The public
|
|
109
|
+
# CompletionResult constructor rejects empty text, so an empty word
|
|
110
|
+
# uses whitespace, which leaves the argument unfilled.
|
|
111
|
+
$unchanged = if ($null -ne $current) { $current.Extent.Text } else { ' ' }
|
|
112
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
113
|
+
$unchanged, $unchanged, 'ParameterValue', 'No completions')
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
if (-not $terminated -and $word.StartsWith('-')) {
|
|
117
|
+
foreach ($option in $schema) {
|
|
118
|
+
foreach ($name in $option.names) {
|
|
119
|
+
if ($name.StartsWith($word, [StringComparison]::Ordinal)) {
|
|
120
|
+
$help = if ($option.help) { $option.help } else { $name }
|
|
121
|
+
[System.Management.Automation.CompletionResult]::new($name, $name, 'ParameterName', $help)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
[System.Management.Automation.CompletionCompleters]::CompleteFilename($word)
|
|
127
|
+
}
|
|
128
|
+
}.GetNewClosure()
|
|
129
|
+
}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
_gukhanmun() {
|
|
2
|
+
local i cur prev opts cmd
|
|
3
|
+
COMPREPLY=()
|
|
4
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
5
|
+
cur="$2"
|
|
6
|
+
else
|
|
7
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
8
|
+
fi
|
|
9
|
+
prev="$3"
|
|
10
|
+
cmd=""
|
|
11
|
+
opts=""
|
|
12
|
+
|
|
13
|
+
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
|
|
14
|
+
do
|
|
15
|
+
case "${cmd},${i}" in
|
|
16
|
+
",$1")
|
|
17
|
+
cmd="gukhanmun"
|
|
18
|
+
;;
|
|
19
|
+
*)
|
|
20
|
+
;;
|
|
21
|
+
esac
|
|
22
|
+
done
|
|
23
|
+
|
|
24
|
+
case "${cmd}" in
|
|
25
|
+
gukhanmun)
|
|
26
|
+
opts="-o -f -p -d -S -s -i -I -r -v -h -V --generate-completion --output --format --preset --dictionary --reference-dictionary --loanword-dictionary --source-policy --reference-only --no-bundled-dictionaries --loanwords --no-loanwords --segmentation --numeral-strategy --numerals --recovery --dueum --initial-sound-law --no-dueum --no-initial-sound-law --no-collapse-parens --punctuation --punctuation-profile --rendering --hanja-variant-set --original-gloss --disambiguation --homophone-detection --first-occurrence --directives --require-hanja --require-hanja-glob --require-hangul --require-hangul-glob --skip-annotation --skip-annotation-glob --html-preserve-class --html-preserve-attr --markdown-frontmatter-convert --verbose --help --version"
|
|
27
|
+
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
|
28
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
29
|
+
return 0
|
|
30
|
+
fi
|
|
31
|
+
case "${prev}" in
|
|
32
|
+
--generate-completion)
|
|
33
|
+
COMPREPLY=($(compgen -W "bash zsh fish powershell nushell" -- "${cur}"))
|
|
34
|
+
return 0
|
|
35
|
+
;;
|
|
36
|
+
--output)
|
|
37
|
+
local oldifs
|
|
38
|
+
if [ -n "${IFS+x}" ]; then
|
|
39
|
+
oldifs="$IFS"
|
|
40
|
+
fi
|
|
41
|
+
IFS=$'\n'
|
|
42
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
43
|
+
if [ -n "${oldifs+x}" ]; then
|
|
44
|
+
IFS="$oldifs"
|
|
45
|
+
fi
|
|
46
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
47
|
+
compopt -o filenames
|
|
48
|
+
fi
|
|
49
|
+
return 0
|
|
50
|
+
;;
|
|
51
|
+
-o)
|
|
52
|
+
local oldifs
|
|
53
|
+
if [ -n "${IFS+x}" ]; then
|
|
54
|
+
oldifs="$IFS"
|
|
55
|
+
fi
|
|
56
|
+
IFS=$'\n'
|
|
57
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
58
|
+
if [ -n "${oldifs+x}" ]; then
|
|
59
|
+
IFS="$oldifs"
|
|
60
|
+
fi
|
|
61
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
62
|
+
compopt -o filenames
|
|
63
|
+
fi
|
|
64
|
+
return 0
|
|
65
|
+
;;
|
|
66
|
+
--format)
|
|
67
|
+
COMPREPLY=("${cur}")
|
|
68
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
69
|
+
compopt -o nospace
|
|
70
|
+
fi
|
|
71
|
+
return 0
|
|
72
|
+
;;
|
|
73
|
+
-f)
|
|
74
|
+
COMPREPLY=("${cur}")
|
|
75
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
76
|
+
compopt -o nospace
|
|
77
|
+
fi
|
|
78
|
+
return 0
|
|
79
|
+
;;
|
|
80
|
+
--preset)
|
|
81
|
+
COMPREPLY=($(compgen -W "ko-kr ko-kp" -- "${cur}"))
|
|
82
|
+
return 0
|
|
83
|
+
;;
|
|
84
|
+
-p)
|
|
85
|
+
COMPREPLY=($(compgen -W "ko-kr ko-kp" -- "${cur}"))
|
|
86
|
+
return 0
|
|
87
|
+
;;
|
|
88
|
+
--dictionary)
|
|
89
|
+
local oldifs
|
|
90
|
+
if [ -n "${IFS+x}" ]; then
|
|
91
|
+
oldifs="$IFS"
|
|
92
|
+
fi
|
|
93
|
+
IFS=$'\n'
|
|
94
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
95
|
+
if [ -n "${oldifs+x}" ]; then
|
|
96
|
+
IFS="$oldifs"
|
|
97
|
+
fi
|
|
98
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
99
|
+
compopt -o filenames
|
|
100
|
+
fi
|
|
101
|
+
return 0
|
|
102
|
+
;;
|
|
103
|
+
-d)
|
|
104
|
+
local oldifs
|
|
105
|
+
if [ -n "${IFS+x}" ]; then
|
|
106
|
+
oldifs="$IFS"
|
|
107
|
+
fi
|
|
108
|
+
IFS=$'\n'
|
|
109
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
110
|
+
if [ -n "${oldifs+x}" ]; then
|
|
111
|
+
IFS="$oldifs"
|
|
112
|
+
fi
|
|
113
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
114
|
+
compopt -o filenames
|
|
115
|
+
fi
|
|
116
|
+
return 0
|
|
117
|
+
;;
|
|
118
|
+
--reference-dictionary)
|
|
119
|
+
local oldifs
|
|
120
|
+
if [ -n "${IFS+x}" ]; then
|
|
121
|
+
oldifs="$IFS"
|
|
122
|
+
fi
|
|
123
|
+
IFS=$'\n'
|
|
124
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
125
|
+
if [ -n "${oldifs+x}" ]; then
|
|
126
|
+
IFS="$oldifs"
|
|
127
|
+
fi
|
|
128
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
129
|
+
compopt -o filenames
|
|
130
|
+
fi
|
|
131
|
+
return 0
|
|
132
|
+
;;
|
|
133
|
+
--loanword-dictionary)
|
|
134
|
+
local oldifs
|
|
135
|
+
if [ -n "${IFS+x}" ]; then
|
|
136
|
+
oldifs="$IFS"
|
|
137
|
+
fi
|
|
138
|
+
IFS=$'\n'
|
|
139
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
140
|
+
if [ -n "${oldifs+x}" ]; then
|
|
141
|
+
IFS="$oldifs"
|
|
142
|
+
fi
|
|
143
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
144
|
+
compopt -o filenames
|
|
145
|
+
fi
|
|
146
|
+
return 0
|
|
147
|
+
;;
|
|
148
|
+
--source-policy)
|
|
149
|
+
COMPREPLY=($(compgen -W "reference-authorized reference-first loanword-first ordered" -- "${cur}"))
|
|
150
|
+
return 0
|
|
151
|
+
;;
|
|
152
|
+
--segmentation)
|
|
153
|
+
COMPREPLY=($(compgen -W "lattice eager" -- "${cur}"))
|
|
154
|
+
return 0
|
|
155
|
+
;;
|
|
156
|
+
-s)
|
|
157
|
+
COMPREPLY=($(compgen -W "lattice eager" -- "${cur}"))
|
|
158
|
+
return 0
|
|
159
|
+
;;
|
|
160
|
+
--numerals)
|
|
161
|
+
COMPREPLY=($(compgen -W "hangul-phonetic positional-arabic additive-arabic smart" -- "${cur}"))
|
|
162
|
+
return 0
|
|
163
|
+
;;
|
|
164
|
+
--numeral-strategy)
|
|
165
|
+
COMPREPLY=($(compgen -W "hangul-phonetic positional-arabic additive-arabic smart" -- "${cur}"))
|
|
166
|
+
return 0
|
|
167
|
+
;;
|
|
168
|
+
--recovery)
|
|
169
|
+
COMPREPLY=($(compgen -W "strict lenient" -- "${cur}"))
|
|
170
|
+
return 0
|
|
171
|
+
;;
|
|
172
|
+
--punctuation)
|
|
173
|
+
COMPREPLY=($(compgen -W "preserve modern traditional traditional-vertical" -- "${cur}"))
|
|
174
|
+
return 0
|
|
175
|
+
;;
|
|
176
|
+
--punctuation-profile)
|
|
177
|
+
local oldifs
|
|
178
|
+
if [ -n "${IFS+x}" ]; then
|
|
179
|
+
oldifs="$IFS"
|
|
180
|
+
fi
|
|
181
|
+
IFS=$'\n'
|
|
182
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
183
|
+
if [ -n "${oldifs+x}" ]; then
|
|
184
|
+
IFS="$oldifs"
|
|
185
|
+
fi
|
|
186
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
187
|
+
compopt -o filenames
|
|
188
|
+
fi
|
|
189
|
+
return 0
|
|
190
|
+
;;
|
|
191
|
+
--rendering)
|
|
192
|
+
COMPREPLY=($(compgen -W "hangul-only hangul-hanja-parens hanja-hangul-parens ruby-on-hangul ruby-on-hanja original" -- "${cur}"))
|
|
193
|
+
return 0
|
|
194
|
+
;;
|
|
195
|
+
-r)
|
|
196
|
+
COMPREPLY=($(compgen -W "hangul-only hangul-hanja-parens hanja-hangul-parens ruby-on-hangul ruby-on-hanja original" -- "${cur}"))
|
|
197
|
+
return 0
|
|
198
|
+
;;
|
|
199
|
+
--hanja-variant-set)
|
|
200
|
+
COMPREPLY=($(compgen -W "as-dictionary shinjitai kanxi simplified asahimoji" -- "${cur}"))
|
|
201
|
+
return 0
|
|
202
|
+
;;
|
|
203
|
+
--original-gloss)
|
|
204
|
+
COMPREPLY=($(compgen -W "parens ruby" -- "${cur}"))
|
|
205
|
+
return 0
|
|
206
|
+
;;
|
|
207
|
+
--disambiguation)
|
|
208
|
+
COMPREPLY=($(compgen -W "off per-block per-section per-document" -- "${cur}"))
|
|
209
|
+
return 0
|
|
210
|
+
;;
|
|
211
|
+
--homophone-detection)
|
|
212
|
+
COMPREPLY=($(compgen -W "context-local dictionary-wide" -- "${cur}"))
|
|
213
|
+
return 0
|
|
214
|
+
;;
|
|
215
|
+
--first-occurrence)
|
|
216
|
+
COMPREPLY=($(compgen -W "off per-block per-section per-document" -- "${cur}"))
|
|
217
|
+
return 0
|
|
218
|
+
;;
|
|
219
|
+
--directives)
|
|
220
|
+
local oldifs
|
|
221
|
+
if [ -n "${IFS+x}" ]; then
|
|
222
|
+
oldifs="$IFS"
|
|
223
|
+
fi
|
|
224
|
+
IFS=$'\n'
|
|
225
|
+
COMPREPLY=($(compgen -f "${cur}"))
|
|
226
|
+
if [ -n "${oldifs+x}" ]; then
|
|
227
|
+
IFS="$oldifs"
|
|
228
|
+
fi
|
|
229
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
230
|
+
compopt -o filenames
|
|
231
|
+
fi
|
|
232
|
+
return 0
|
|
233
|
+
;;
|
|
234
|
+
--require-hanja)
|
|
235
|
+
COMPREPLY=("${cur}")
|
|
236
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
237
|
+
compopt -o nospace
|
|
238
|
+
fi
|
|
239
|
+
return 0
|
|
240
|
+
;;
|
|
241
|
+
--require-hanja-glob)
|
|
242
|
+
COMPREPLY=("${cur}")
|
|
243
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
244
|
+
compopt -o nospace
|
|
245
|
+
fi
|
|
246
|
+
return 0
|
|
247
|
+
;;
|
|
248
|
+
--require-hangul)
|
|
249
|
+
COMPREPLY=("${cur}")
|
|
250
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
251
|
+
compopt -o nospace
|
|
252
|
+
fi
|
|
253
|
+
return 0
|
|
254
|
+
;;
|
|
255
|
+
--require-hangul-glob)
|
|
256
|
+
COMPREPLY=("${cur}")
|
|
257
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
258
|
+
compopt -o nospace
|
|
259
|
+
fi
|
|
260
|
+
return 0
|
|
261
|
+
;;
|
|
262
|
+
--skip-annotation)
|
|
263
|
+
COMPREPLY=("${cur}")
|
|
264
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
265
|
+
compopt -o nospace
|
|
266
|
+
fi
|
|
267
|
+
return 0
|
|
268
|
+
;;
|
|
269
|
+
--skip-annotation-glob)
|
|
270
|
+
COMPREPLY=("${cur}")
|
|
271
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
272
|
+
compopt -o nospace
|
|
273
|
+
fi
|
|
274
|
+
return 0
|
|
275
|
+
;;
|
|
276
|
+
--html-preserve-class)
|
|
277
|
+
COMPREPLY=("${cur}")
|
|
278
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
279
|
+
compopt -o nospace
|
|
280
|
+
fi
|
|
281
|
+
return 0
|
|
282
|
+
;;
|
|
283
|
+
--html-preserve-attr)
|
|
284
|
+
COMPREPLY=("${cur}")
|
|
285
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
286
|
+
compopt -o nospace
|
|
287
|
+
fi
|
|
288
|
+
return 0
|
|
289
|
+
;;
|
|
290
|
+
--markdown-frontmatter-convert)
|
|
291
|
+
COMPREPLY=("${cur}")
|
|
292
|
+
if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then
|
|
293
|
+
compopt -o nospace
|
|
294
|
+
fi
|
|
295
|
+
return 0
|
|
296
|
+
;;
|
|
297
|
+
*)
|
|
298
|
+
COMPREPLY=()
|
|
299
|
+
;;
|
|
300
|
+
esac
|
|
301
|
+
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
302
|
+
return 0
|
|
303
|
+
;;
|
|
304
|
+
esac
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then
|
|
308
|
+
complete -F _gukhanmun -o nosort -o bashdefault -o default gukhanmun
|
|
309
|
+
else
|
|
310
|
+
complete -F _gukhanmun -o bashdefault -o default gukhanmun
|
|
311
|
+
fi
|