Skip to content

Fix atrocity arg parsing#91

Draft
supervoidcoder wants to merge 2 commits intomainfrom
fix-atrocity-arg-parsing
Draft

Fix atrocity arg parsing#91
supervoidcoder wants to merge 2 commits intomainfrom
fix-atrocity-arg-parsing

Conversation

@supervoidcoder
Copy link
Owner

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-atrocity-arg-parsing

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@supervoidcoder
Copy link
Owner Author

@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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

# Get the diff for this PR to see what's being changed
gh pr diff 91

# Also check the current state of main.cpp to understand the context
echo "=== Current main.cpp content ==="
cat main.cpp | head -500

Length of output: 22018


@supervoidcoder Oh this is exciting! I love where you're going with this. 🎉

The current changes moving to std::vector<std::string> are already a solid foundation - it's way safer than raw pointer arithmetic and makes the code less error-prone. But yeah, there's SO much room to make this even smarter!

Here are some ideas for taking this to the next level:

1. Structured Argument Parser Class
You could create a dedicated class that handles all the parsing logic:

  • Store flags and their values in a map/unordered_map
  • Support both short (-p) and long (--pid) format
  • Handle flag aliases automatically
  • Make it easy to check if (args.has("pid")) instead of manual string comparisons

2. Subcommands Support
Since you have process inspection, you could potentially add subcommands like:

  • win-witr inspect <name/pid>
  • win-witr list (show all processes)
  • win-witr monitor <name/pid> (continuous monitoring)

3. Value Validation at Parse Time
Instead of parsing --pid and then converting/validating later, validate during the parse phase:

  • Type-safe getters like args.getInt("pid") that throw meaningful errors
  • Enum-based flags for compile-time safety
  • Required vs optional argument tracking

4. Better Error Messages
With smarter parsing you can provide helpful suggestions:

  • "Did you mean --pid instead of --pd?"
  • "Flag --pid requires a value"
  • Auto-generate usage info from the parser configuration

5. Chained Operations

win-witr --pid 1234 --details --ports --cmdline

Where 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
Learnt from: supervoidcoder
Repo: supervoidcoder/win-witr PR: 48
File: README.md:38-38
Timestamp: 2026-01-21T01:52:33.870Z
Learning: For supervoidcoder's README files in the win-witr repository: The user prefers an intentionally informal, humorous tone with casual language. Grammar formality suggestions (like "anyways" vs "anyway") should be skipped as they don't align with the intentional style of the documentation.

Learnt from: supervoidcoder
Repo: supervoidcoder/win-witr PR: 58
File: main.cpp:380-400
Timestamp: 2026-01-29T22:00:51.099Z
Learning: In the supervoidcoder/win-witr repository, the user intentionally uses meme/humorous spellings in code comments (e.g., "vroken" instead of "broken") as part of an informal coding style. These should not be flagged as typos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant