Python Forum
i need a module for more involved command line parsing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i need a module for more involved command line parsing
#1
i am wanting to rewrite this C program into Python3. any suggestions for a module that can handle this kind of command line argument parsing?
Output:
lt2a/forums /home/forums 1> rls -h rls version 0.9.0 syntax: rls [options] [names] single letter options may be combined in a single command line token: -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 maximum depth -a append '/' to directory names -b show blocks allocated -d -D show date (-d for local, -D for UTC) -g -G show group name (-G for group number) -h -H show this help and quit -i show inode -l show long format -L show number of links -m show mode -n append nanoseconds to time (if available) -N append nanoseconds to time (if available) -p show where link points to -q output nothing -s show size -S show time/date as raw seconds -t -T show time and date (-t for local, -T for UTC) -u -U show user name (-U for number) -V show version number and quit +a select directories (ascending) +b select block devices +c select character devices +d select directories (descending) +h +H show this help and quit +f select regular files +l select symlinks +p select pipes +s select sockets +V show version number and quit assignment options must be in separate command line tokens: cd=<directory> change to this directory (multiple) maxdepth=<num> maximum recursion depth lt2a/forums /home/forums 2>
i'm also thinking about extending the options so they can be changed in the middle of the command line and apply to the names that follow them.
Tradition is peer pressure from dead people

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


Messages In This Thread
i need a module for more involved command line parsing - by Skaperen - Aug-24-2019, 07:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  module either imported by a command or itself run as a command Skaperen 2 718 Dec-04-2023, 03:15 AM
Last Post: Skaperen
  review of command line parsers Skaperen 2 2,162 Mar-11-2021, 07:39 PM
Last Post: Skaperen
  command line options Skaperen 5 2,784 Aug-14-2020, 08:48 AM
Last Post: DeaD_EyE
  opening python from the command line takes a long time to load? abdulkaderanwar 4 3,177 Jun-22-2020, 03:42 AM
Last Post: abdulkaderanwar
  f-string in command line arguments Skaperen 0 1,694 May-05-2020, 11:49 PM
Last Post: Skaperen
  my own command line option parser Skaperen 0 1,714 Mar-27-2020, 04:14 AM
Last Post: Skaperen
  want suggested module for e-mail parsing Skaperen 0 1,596 Jul-26-2019, 08:52 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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