Support for tcsh completion#57
Conversation
|
Pinging @casperdcl from #56. |
|
Friendly ping @casperdcl |
casperdcl
left a comment
There was a problem hiding this comment.
thanks! Just not sure about the test (seems to imply complete_tcsh doesn't really do much?)
|
I can squash everything into a single commit in the end, if you prefer. |
no need, it's ok :) |
0461bf9 to
b2e5a2c
Compare
casperdcl
left a comment
There was a problem hiding this comment.
awesome! can you update docs/use.md (used to generate https://docs.iterative.ai/shtab/use/) with installation instructions for tcsh?
This is incomplete due to tcsh limitations, but functional (iterative#56) Make customcomplete herder to parser Mixup main parser positionals and sub-parser positionals on the same "position".
Tweak customcomplete completion See iterative#57 (comment)
|
/tag v1.5.0 25e3e44 |
|
Thanks for the quick review. |
|
Oops, I did not run the tests on python 2.7, and nether did the actions run when I pushed. Line 644 in 46302c5 Line 661 in 46302c5 Unpacking lists doesn't work. Did a quick test, you can apply this patch: diff --git i/shtab/__init__.py w/shtab/__init__.py
index d3747f7..da279b4 100644
--- i/shtab/__init__.py
+++ w/shtab/__init__.py
@@ -641,7 +641,7 @@ def complete_tcsh(parser, root_prefix=None, preamble="", choice_functions=None):
if not requirements and isinstance(positional.choices, dict):
for subcmd, subparser in positional.choices.items():
log.debug('%s| | SubParser: %s', log_prefix, subcmd)
- recurse_parser(subparser, positional_idx, [*requirements, subcmd])
+ recurse_parser(subparser, positional_idx, [r for r in requirements] + [subcmd])
recurse_parser(parser, 0)
@@ -658,7 +658,7 @@ def complete_tcsh(parser, root_prefix=None, preamble="", choice_functions=None):
'[ "$cmd[{}]" == "{}" ]'.format(iidx, n) for iidx, n in enumerate(nn, start=2)]
if arg.choices:
nlist.append('( {}echo "{}" || false )'.format(
- ' && '.join([*checks, '']), # Append the separator
+ ' && '.join([c for c in checks] + ['']), # Append the separator
'\\n'.join(arg.choices),
)) |
|
yes I think misconfigured tests also meant they didn't run pre-merge |
The main problem is that it needs a new tag, since the existing tag failed halfway. The tests pass with that tag. |
|
Oops, I was testing this on a large parser, and I missed skipping the Lines 628 to 634 in 3aca487 It's a matter of gating that with |
yes please do 🙏 |
This is incomplete due to tcsh limitations, but functional.
See #56
Here are some examples generated with this: