-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Suggestion] Additional Text On CLI help page #1
Comments
@pgamerx I decided to remove I'm planning on adding a way to override the help text. I'm thinking something like this: function __help__({ name, version, commands, options }) {
console.log("...whatever you want to say")
}
export const cli = {
__help__
} I could even pass the default text in so you can just append/prepend your own message. function __help__({ defaultMessage }) {
console.log(defaultMessage + "\n your custom message")
} Thoughts? |
That does seem a great idea! Also, I had a little bit of issue working with options like function info(website: boolean = false).... It was something like this, can you guide me on this as well? Thanks! |
I think two things are happening here. 1. Default Paramaters and Interactive ModeThe first is I haven't set up the library to handle parameters with default values yet. I'm not sure yet the best way to do this. Consider the the following two ways to run the CLI:
Interactive mode example: $ <cli> info
? website › - Use arrow-keys. Return to submit.
❯ True
False What's unclear to me is whether having a default value for However, by giving it a default value you would be making it so there is no way to interact with that parameter via interactive mode, but maybe that's ok? You would also have this usecase where a function could be partially interactive. In the example below, you can interact with a, but you will never be able to interact with b (assuming we make it so default values bypass interactive mode). function example(a: number, b: boolean = false) {} 2. Handling flagsThe CLI is not currently setup to handle user created flags. All parameters after a command are positional. I am thinking about adding flags, but there are a few things to consider.
Consider the example below: function foo(a: { a: number }, b: { a: number }) {} If you run One more thingI haven't decided how to handle arrays yet, and I'm curious to hear your thoughts on this. How should we handle the following function: function foo(arr: (string | number)[]) {} I'm not sure the best interface to handle arrays like this. We would need to ask the user if they want to end input for that array, enter another value, and if they enter another value whether it should be a string or number. I'm skeptical how useful these array parameters will be which is why I decided to handle objects first, but I think they will come up at some point. Any thoughts? |
Btw, I really appriciate your input. Its much easier for me to make the right design choices when I can understand usecases that I might not be envisioning. Please keep the questions coming! |
Thanks for the update, and no problem. |
Hi, sorry for the late response I was just very busy with my studies.
|
Got it. I need to think about this a little more. I'm already in the process of removing the internal flags. I'm gonna try to keep the internal commands as slim as possible to avoid conflicts. |
Hi there, Your package is amazing!
I made my own CLI using it.
On the help page, it says this:
I don't mind the "Powered by @christianjuth/ts-CLI-generator" line, but I was wondering if there was a way for us to add custom lines along with it as well!
If Not then I would highly suggest adding a feature like this!
The text was updated successfully, but these errors were encountered: