File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -732,29 +732,32 @@ def do_neigh_flush(argv, af):
732732
733733@help_msg ("do_help" )
734734def main (argv ):
735- # Detect Address family
736735 af = - 1 # default / both
737- if argv and argv [0 ] == "-6" :
738- af = 6
739- argv .pop (0 )
740- elif argv and argv [0 ] == "-4" :
741- af = 4
742- argv .pop (0 )
743736
744- if not argv :
745- return False
746-
747- if argv [0 ] in ["-V" , "-Version" ]:
748- print ("iproute2mac, v" + VERSION )
749- exit (0 )
737+ # Check all the options
738+ while argv and argv [0 ].startswith ("-" ):
739+ # Detect Address family
740+ if argv [0 ] == "-6" :
741+ af = 6
742+ argv .pop (0 )
743+ elif argv [0 ] == "-4" :
744+ af = 4
745+ argv .pop (0 )
746+ elif argv [0 ].startswith ("-color" ):
747+ perror ("iproute2mac: Color option is not implemented" )
748+ argv .pop (0 )
749+ elif "-Version" .startswith (argv [0 ]):
750+ print ("iproute2mac, v" + VERSION )
751+ exit (0 )
752+ elif "-help" .startswith (argv [0 ]):
753+ return False
754+ else :
755+ perror ('Option "{}" is unknown, try "ip help".' .format (argv [0 ]))
756+ exit (255 )
750757
751- if argv [ 0 ] in [ "-h" , "-help" ] :
758+ if not argv :
752759 return False
753760
754- if argv [0 ].startswith ("-" ):
755- perror ('Option "{}" is unknown, try "ip -help".' .format (argv [0 ]))
756- exit (255 )
757-
758761 for cmd , cmd_func in cmds :
759762 if cmd .startswith (argv [0 ]):
760763 argv .pop (0 )
You can’t perform that action at this time.
0 commit comments