vulcano
vulcano copied to clipboard
Custom completion for arguments
Hi! This framework is awesome, looks like just what I'm looking for. I'm missing a capability though: complete a command's argument from a list of possibilities, or a function returning a list of posibilities:
Say:
def names():
return ["Pete","Mike","Audrey"]
@app.command("name", "Search for name", arg_opts=names)
def name_funct(n):
app.context["name"] = n
And when using the command name in the REPL, as soon as I hit spacebar, Pete, Mike and Audrey would show up as argument completions. Is this viable?
I see what you mean, but this feature is not available for now.
The completion is only based on argument names, not on its values.
This will require adding a new class like “Choices” or something like that and use it as an argument value whenever you want to force the user to select one of those possible values.
If you have another idea to implement it, I’m totally open to merge requests and discussions :)
PD: glad you like the framework ;)
El 5 mar 2020, a las 20:20, Marcos Alfredo Núñez [email protected] escribió:
Hi! This framework is awesome, looks like just what I'm looking for. I'm missing a capability though: complete a command's argument from a list of possibilities, or a function returning a list of posibilities:
Say:
def names(): return ["Pete","Mike","Audrey"]
@app.command("name", "Search for name", arg_opts=names) def name_funct(n): app.context["name"] = n And when using the command name in the REPL, as soon as I hit spacebar, Pete, Mike and Audrey would show up as argument completions. Is this viable?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
I'd like to potentially implement this for Enums. Do you have any more tips on how to go about this?
This also seems like a natural thing to extend to 'path' arguments as well
Hi Gavan,
Could you provide an example snippet with the expected behavior?
Thanks!
El 3 may 2020, a las 4:02, Gavan Wilhite [email protected] escribió:
This also seems like a natural thing to extend to 'path' arguments as well
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.