Free-form argument in the middle of a command line

20 views
Skip to first unread message

Maarten Boekhold

unread,
Aug 24, 2023, 9:42:48 AM8/24/23
to jline-users
Hi all,

I'm trying to build a TreeCompleter that ends up working with the following command line:

POST dev_env /free/form/url src/resources/test.json result.json

where:
- "POST" is auto-completed
- "dev_env" is auto-completed from a list built from a configuration file
- /free/form/url is manually typed by the user
- src/resources/test.json is a FilesCompleter
- result.json is manually typed

and I can't get it to work. I'm trying with different variations of:
Completer completer = new Completers.TreeCompleter(
node(
"POST",
node(getResourceCompleter()),
"free-text",
node(new Completers.FilesCompleter(Paths.get("."))),
"free-text"
)
)
Specifically trying out different XxxCompleters in the place of those "free-text" arguments, but after I type "POST dev_env /my/url ", completion just stops. Pressing tab doesn't do anything anymore, while I'm expecting it to give me a list of filenames to complete from.

Any suggestions?

Maarten

Maarten Boekhold

unread,
Aug 24, 2023, 10:38:24 AM8/24/23
to jline-users
FYI I'm using jline 3.10.0, because 3.23.0 crashes on me with a SIGSEGV...

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f05faa6ba29, pid=32931, tid=32959
#
# JRE version: OpenJDK Runtime Environment (11.0.20+8) (build 11.0.20+8-post-Ubuntu-1ubuntu123.04)
# Java VM: OpenJDK 64-Bit Server VM (11.0.20+8-post-Ubuntu-1ubuntu123.04, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xa6ba29]  LinkResolver::resolve_invokevirtual(CallInfo&, Handle, constantPoolHandle const&, int, Thread*)+0xe9

Tried with OpenJDK 11 and 17...
Reply all
Reply to author
Forward
0 new messages