Several questions #225
-
Hello, thanks a lot for this awesome library ! I've been experimenting a bit with cliffy and I have several questions that I couldn't find answer in documentation. 1) Is there a way do to command aliases ? Something like: new Command()
.command("docs, documentation", new Command())
//Current workaround
const docs = new Command()
new Command()
.command("docs", docs)
.command("documentation", documentation) 2) Is it possible to handle unknown options ? For instance, if I was passing
But would it be possible to catch all 3) How to correctly handle "empty commands" Say I have the following: await new Command()
.command("sub", new Command()
.action(() => console.log("hello"))
)
.parse(Deno.args) How do I make it fall it errors if "sub" command is not provided ? Currently it justs ouputs nothing. I'd like to have a similiar output as when passing an unknown command like:
Edit: Found out that adding a 4) Is it possible to make options conflictings with arguments Maybe this is out of scope, but I was wondering whether it's possible to make options conflicts with some command optional arguments, like: await new Command()
.command("sub <arg1> [arg2]", new Command()
.option("--ok-but-only-if-no-arg2", {conflicts:["arg2"]))
)
.parse(Deno.args) 5) Is it by choice that GitHub provider is not exported and must be imported from file instead ? deno-cliffy/command/upgrade/mod.ts Lines 1 to 4 in d93ad7d 6) Is there some way to remove "v" in version name ? Setting version to
Thanks for all answers! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @lowlighter, i'm glad you like cliffy! 1) Is there a way do to command aliases ? cmd.command("rm, remove <dir>")
# or
cmd.command("rm <dir>").alias("remove") 2) Is it possible to handle unknown options ? 3) How to correctly handle "empty commands" await new Command()
.arguments("<some-other-argument>")
.action((_, arg) => console.log(`hello from main command with argument: ${arg}`))
.command("sub", "some sub command")
.action(() => console.log("hello from sub command"))
.parse(); 4) Is it possible to make options conflictings with arguments 5) Is it by choice that GitHub provider is not exported and must be imported from file instead ? 6) Is there some way to remove "v" in version name ? Thx for all the points @lowlighter 👍 Can you create separate issues for all the bugs and feature request? Than we can better discuss it and start working on them. Otherwise i can also do it. |
Beta Was this translation helpful? Give feedback.
Hi @lowlighter, i'm glad you like cliffy!
1) Is there a way do to command aliases ?
Aliases are already supported. But it looks like they are not well documented. Will update the documentation. There are two ways to specify command aliases:
2) Is it possible to handle unknown options ?
Unknown options are currently not supported but would make sence! Can you open an issue for this? Than i will check how we can implement something like this.
Maybe it would also be nice to specify a regex like pattern for option/command names. But we have to ensure that this doesn't has a huge impact to the perfomance. But somethin…