wasp
wasp copied to clipboard
Context help for `wasp new` without project.
Is your feature request related to a problem? Please describe.
If I command wasp-cli new
but don't give a name then I don't get help in that context.
> wasp-cli new
USAGE
wasp <command> [command-args]
COMMANDS
GENERAL
new <project-name> Creates new Wasp project.
version Prints current version of CLI.
IN PROJECT
start Runs Wasp app in development mode, watching for file changes.
db <db-cmd> [args] Executes a database command. Run 'wasp db' for more info.
clean Deletes all generated code and other cached artifacts. Wasp equivalent of 'have you tried closing and opening it again?'.
build Generates full web app code, ready for deployment. Use when deploying or ejecting.
telemetry Prints telemetry status.
deps Prints the dependencies that Wasp uses in your project.
info Prints basic information about current Wasp project.
EXAMPLES
wasp new MyApp
wasp start
wasp db migrate-dev
Docs: https://wasp-lang.dev/docs
Discord (chat): https://discord.gg/rzdnErX
Describe the solution you'd like
Help specific to the new command and a mention that <project-name>
is needed here.
Sounds good! I could argue that the stuff printed above helps enough, since there is new <project-name>
... there, but I guess that specialized message could be nicer. Any suggestions on what the output would be? Maybe comparable output from another tool?
We roll our own parsing of the command line and displaying help for it.
https://github.com/wasp-lang/wasp/blob/f444eaae4790ccec7c47d76662da13b26ba4e0d7/waspc/cli/Main.hs#L26-L45
https://github.com/wasp-lang/wasp/blob/f444eaae4790ccec7c47d76662da13b26ba4e0d7/waspc/cli/Main.hs#L71-L98
I've used cmdArgs but optparse-applicative is more popular and seems to provide all we need; colors, subcommands, footer and lots more.
https://packdeps.haskellers.com/reverse/cmdargs https://packdeps.haskellers.com/reverse/optparse-applicative
It also gives bash completions when again we've rolled our own with #305.
https://github.com/pcapriotti/optparse-applicative/wiki/Bash-Completion
How about we switch to using optparse-applicative?
Hi @philderbeast! Pleased to virtually meet you. 😄 I am a new member of the Wasp team and will be looking into this issue. I appreciate you opening an enhancement request for a possible area of cli help text improvement!
Also, thanks for the suggestion on using a command line parsing lib. Please allow me a bit of time to review the options and we can come up with a plan. If we decide to refactor the command line parsing, we can update the help text as part of that. If that does not happen, or is a ways off, we can circle back to this exact issue about wasp new
feedback. Thanks and I will be in touch!
Just to add historical context :D -> there is no special reason why we used our own solution, it just organically evolved into this. I remember doing a quick investigation into libraries but I believe I concluded it might be easiest to start with something basic. I don't think I was aware of cmdArgs or optparse-applicative, or if I was maybe I thought they are too complex.
Nice to meet you @shayneczyzewski.
Yes @Martinsos, organic evolution is the best. Look how far we've come ;-)
Nice to meet you @shayneczyzewski.
Yes @Martinsos, organic evolution is the best. Look how far we've come ;-)
Hah yes, well I am not a proponent of organic evolution per se, just wanted to give some context! Maybe organically the time has come to use optparse-applicative :D.
Hi @philderbeast it does indeed seem like optparse-applicative is the preferred command line arg parsing library these days. While I do think it could be a nice enhancement, given that the existing hand rolled solution functions well enough for the current stage of Wasp and keeping in mind what we have to do in the near future to reach Beta, I am going to put this on the internal backlog until we add our next command (which could be something cool like wasp deploy
🎉 ). When we add that next command, we can then (a) evaluate the refactor to optparse-applicative, as well as (b) add additional help for specific commands if we get additional feedback similar to yours.
TLDR optparse-applicative sounds really interesting and worth considering in the future when we feel the need for it, or if somebody decides to pick it up in the meantime! Thanks!