Conversation
…trings rather than manually parsing each one on the fly
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai hmm I have so much planned for this... What do you think of much smarter arg parsing I think this will be pretty fun |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 22018
The current changes moving to Here are some ideas for taking this to the next level: 1. Structured Argument Parser Class
2. Subcommands Support
3. Value Validation at Parse Time
4. Better Error Messages
5. Chained Operations win-witr --pid 1234 --details --ports --cmdlineWhere each flag adds a section to the output. The comment about "never increment the actual variable" suggests you've hit some of the pain points of manual parsing - a proper parser would handle that state management for you automatically! What direction were you thinking? I'm curious what you have planned! 🚀 🧠 Learnings used |
|
@coderabbitai i'm thinking of adding a --verbose flag, but what would the shorthand be? -v is already for --version |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 221
1.
2. No shorthand at all
3.
4.
My recommendation: Go with Plus, if you ever want verbose levels later, you could do What do you think? 🧠 Learnings used |
|
@coderabbitai also i just remembered like shutdown /h instead of shutdown -h (which works too but yknow) |
|
Tip For best results, initiate chat on the files or code changes.
You're absolutely right - Windows has its own CLI heritage with the The best part: You can support both styles simultaneously! Many modern Windows tools do this:
Implementation approach: When parsing args, just normalize the prefix: std::string normalizeFlag(const std::string& arg) {
// Convert /flag to --flag or /-f to -f
if (arg[0] == '/') {
if (arg.length() == 2) {
return "-" + arg.substr(1); // /v -> -v
} else {
return "--" + arg.substr(1); // /verbose -> --verbose
}
}
return arg;
}Then parse as usual. This way you get:
Examples of how it would look: Gives it that authentic Windows CLI vibe! And users coming from Unix/Linux backgrounds will still feel at home with Do you want to support both styles, or go full Windows and use ✏️ Learnings added
🧠 Learnings used |
No description provided.