Skip to content

Commit 94bdf0b

Browse files
metaistclaude
andcommitted
add: cosmofy completions command for shell completions (closes #117)
Generate bash, zsh, and fish completion scripts by parsing usage strings. Follows baton's philosophy: derive completions from conventions in usage text rather than requiring additional metadata. Usage: cosmofy completions bash > ~/.bash_completion.d/cosmofy cosmofy completions zsh > ~/.zfunc/_cosmofy cosmofy completions fish > ~/.config/fish/completions/cosmofy.fish Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 94e746d commit 94bdf0b

File tree

4 files changed

+1588
-1
lines changed

4 files changed

+1588
-1
lines changed

.cspell.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@
1010
"CLICOLOR",
1111
"codeql",
1212
"cogapp",
13+
"compdef",
14+
"compgen",
15+
"COMPREPLY",
1316
"compresslevel",
1417
"cosmofy",
1518
"docstrings",
1619
"doctest",
20+
"esac",
1721
"exitmsg",
22+
"filedir",
1823
"fpclose",
1924
"htmlcov",
2025
"levelname",
@@ -25,9 +30,9 @@
2530
"mycommand",
2631
"mydir",
2732
"mypackage",
28-
"nmycmd",
2933
"mypy",
3034
"myscript",
35+
"nmycmd",
3136
"nojekyll",
3237
"oneline",
3338
"outl",
@@ -49,9 +54,13 @@
4954
"pythonversion",
5055
"removeprefix",
5156
"setuptools",
57+
"subcmd",
58+
"subcmds",
59+
"subsub",
5260
"unknowntag",
5361
"urlopen",
5462
"venv",
63+
"zfunc",
5564
"zinfo"
5665
]
5766
}

src/cosmofy/__main__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from .baton import ColorHandler
1616
from .baton import Command
1717
from .bundle import cmd as bundle
18+
from .completions import cmd as completions
1819
from .fs.__main__ import cmd as fs
1920
from .self.__main__ import cmd as self
2021
from .self.version import print_version
@@ -33,6 +34,7 @@
3334
updater install/uninstall bundle self-updater
3435
fs inspect and modify an existing bundle
3536
self manage the `cosmofy` executable
37+
completions generate shell completions
3638

3739
Options:
3840
--version display the program version and exit
@@ -75,6 +77,7 @@ def run(args: Args) -> int:
7577
usage,
7678
{
7779
"bundle": bundle,
80+
"completions": completions,
7881
"updater": updater,
7982
"fs": fs,
8083
"self": self,

0 commit comments

Comments
 (0)