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
docs: update cli options help #246
Conversation
nobkd
commented
Mar 28, 2024
•
edited
edited
- resolve Update CLI help message to represent current options #243
Thanks! Is this still a work in progress? What are those "x" entries? If unaware: --dry-run only shows what is being build, but does not do anything |
Yeah, it's work in progress. The |
What about the order of the options? Just did it now, as I thought would be relevant 🤷 Also, I see some possible problems with the current option parsing: nue/packages/nuekit/src/cli.js Line 40 in 850e85f
What if a file path for an nue/packages/nuekit/src/cli.js Line 58 in 850e85f
Probably won't ever happen, because the
|
I don't think, it's correct that Important Will have to add that to the description, if that's correct like that Will have to check, if it's maybe just my current project... |
My diff idea for this (#246 (comment)) would be nue/packages/nuekit/src/cli.js Lines 39 to 68 in 850e85f
// options
- } else if (arg[0] == '-') {
+ } else if (!opt && arg[0] == '-') {
// booleans
if (['-p', '--production'].includes(arg)) args.is_prod = true
else if (['-v', '--version'].includes(arg) && !args.cmd) args.version = true
else if (['-n', '--dry-run'].includes(arg)) args.dryrun = true
else if (['-h', '--help'].includes(arg)) args.help = true
else if (['-v', '--verbose'].includes(arg)) args.verbose = true
else if (['-s', '--stats'].includes(arg)) args.stats = true
else if (['-b', '--esbuild'].includes(arg)) args.esbuild = true
else if (['-P', '--push'].includes(arg)) args.push = true
else if (['-I', '--init'].includes(arg)) args.init = true
// string values
else if (['-e', '--environment'].includes(arg)) opt = 'env'
else if (['-r', '--root'].includes(arg)) opt = 'root'
// bad options
- else if (opt) throw `"${opt}" option is not set`
else throw `Unknown option: "${arg}"`
} else if (arg) {
if (opt) { args[opt] = arg; opt = null }
else args.paths.push(arg)
- }
+ } else if (opt) throw `"${opt}" option is not set`
})
return args
} Problem is, that |
Yeah. Clearly some issues in there with special file names and need to be fixed somehow. I think filenames starting with "-" are not a priority atm. |
Okay... I started looking here again. And nue/packages/nuekit/src/cli.js Lines 108 to 118 in 2842df8
nue/packages/nuekit/src/nuekit.js Line 325 in 2842df8
changing the latter to I think it would be better to just add dry-run to |
I'll just skip stats printing if dry-run is active, alright? |
I've changed the code according to my ideas. Please let me know if you see potential for improvement. |
Looks solid. Thank you! |