Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cli arguments parser
#1
there already exits a cli arguments parser. but it looks like a copy of the Posix one, which is a rendition of the old Unix one. worthless for me. here are the kinds of things i want:

1. continue parsing for more errors if at all possible after an error.
2. if parsing cannot continue, return all errors, do not raise an exception.
3. errors should have information describing where the error is, including position and text.
4. for conflicts, including redundancy errors, also include where the conflict is
5. support any prefixes like - and -- and + and ++ ... whatever is specified.
6. support single letter options combined in the same argument (+f-l is like +f -l)
7. support sub-arguments for combined single letter options.
8. allow specifying whether an option can be other cased.
9. allow combining sub-arguments (+f=foo -a=read is like +f-a foo read).
10. use correct os semantics for file checking (pathlib provides).
11. provide a means to apply this parsing to other data sources (like providing in a list)

i once tried to do this in C. but it needed a lot of things that are available in Python. so i don't have an example to show. a few of my C programs did some of the advanced parsing themselves. you can see one here. none ever used getopt().
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020