Closed angelcaru closed 5 months ago
Yes, check the example (examples/args_test.rn
)
I can't use it like this examples/args_test.rn --version
.
That's because the argument list is hardcoded in the example. Change it to sys_args()
(or some slice of that that skips the initial Python program args)
Oh, wait. The interpreter tries to recognize the arguments passed to the program as its own (and fails). So we can't pass command-line arguments to Radon programs yet.
Yeah, Python is detecting those arguments and parsing with it's internal Argparse
module which is used in radon.py
.
That means we probably need to stop using it ourselves. The CLI isn't that complex so we should be able to rewrite it without argparse
Yeah, you can try that.
Can you implement a basic CLI program for demo with all features included which is implemented till now.
ok
I made it
--help
it not working
--max-lines
issue
Elaborate
I think we need to handle them from Argparse
module side.
Yeah but what is the issue?
Elaborate
Oops, it was my mistake with passing line limit.
But without a value it is crashing...
Wrong file name is crashing.
I know. This is just a PoC of the Argparse, no need to fix that
Then we need to move all those crash issue to main module, so any user can use it without any issues.
What are you talking about?
It's just an example, there's no intent for it to be used as an actual alternative to grep
It's just an example, there's no intent for it to be used as an actual alternative to
grep
Cool down. I am asking to merge crashing issue which we are handling manually in to Argparse
. So, it can handle those things it self.
What crashing issue? You only mentioned it crashing on non-existent files, which is not a concern of Argparse
I am not asking that. If no value is passed, it will send warning by it self. Also the argv
will be called from inside of Argparse
, we just need to call parser.parse()
. This will be more abstract.
OK, that makes sense now
Is it usable now?