Comments (3)
What's happening with your code:
autocomplete set abc { [{
"Dynamic": ( { -> %[ "xyz" ] } ),
"Flags": [ "-foo" ],
"FlagValues": {
"-foo": [{
"Flags": [ "bar" ]
}]
}
}] }
...is that xyz
and -foo
are both flags expected to be followed after the command.
The following code works as requested:
autocomplete set abc { [
{
"Flags": [ "-foo" ],
"FlagValues": {
"-foo": [{
"Flags": [ "bar" ]
}]
},
"optional": true
},
{
"Dynamic": ( { -> %[ "xyz" ] } )
}
] }
Where this differs is you're saying the first group is optional and -foo
expects the value bar
. The second group isn't optional and that returns the xyz
value from your dynamic block.
from murex.
Thanks, that approach is working!
I've written a few autocompletions now and I thought I'd read the autocomplete
builtin's documentation relatively thoroughly, but the concept of groups didn't really click for me until just now.
from murex.
Yeah, it's not really explained in the docs. The basic idea is the groups are to define position dependant parameters. While FlagValues
define flag dependant parameters.
In your case you needed a mixture of two: flag dependant (for -foo
) but also position dependant (xyz
must follow any optional flags).
The gotcha with this is if xyz
can come before or after -foo
.
from murex.
Related Issues (20)
- Ternary operator
- lambda support
- Create a "deprecated" section
- Disable walk history while in `[f9]` preview mode
- readline: some hotkeys no longer update terminal with readline state
- Variables sometimes return base64 encoded values
- Error on windows: Error creating table preview_command: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work HOT 9
- Website: Opening "config" builtins page from left menu breaks site HOT 2
- "Nullness" of a JSON null is lost while iterating using formap HOT 4
- rewrite object creator parser
- Zero-length environment variables reported as null HOT 1
- Murex bug: database is locked (5) (SQLITE_BUSY): '/home/me/.murex_modules/cache.db' HOT 1
- murex panic: runtime error: index out of range [0] with length 0 HOT 2
- Comparision to NuShell HOT 1
- bg { command } fails to run command HOT 4
- expressions/exp14 causes panic: `index out of range`
- High memory usage in `[f9]` preview
- Option to hide "Loading profile" messages on start HOT 2
- Formatting a JSON Object as CSV no longer works HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from murex.