()
| 11 | |
| 12 | |
| 13 | def main(): # type: () -> None |
| 14 | parser = argparse.ArgumentParser( |
| 15 | "getmac", |
| 16 | description="Get the MAC address of system network " |
| 17 | "interfaces or remote hosts on the LAN", |
| 18 | ) |
| 19 | parser.add_argument( |
| 20 | "--version", action="version", version="getmac %s" % getmac.__version__ |
| 21 | ) |
| 22 | parser.add_argument( |
| 23 | "-v", "--verbose", action="store_true", help="Enable output messages" |
| 24 | ) |
| 25 | parser.add_argument( |
| 26 | "-d", |
| 27 | "--debug", |
| 28 | action="count", |
| 29 | help="Enable debugging output. Add characters to " |
| 30 | "increase verbosity of output, e.g. '-dd'.", |
| 31 | ) |
| 32 | parser.add_argument( |
| 33 | "-N", |
| 34 | "--no-net", |
| 35 | "--no-network-requests", |
| 36 | action="store_true", |
| 37 | dest="NO_NET", |
| 38 | help="Do not use arping or send a UDP packet to refresh the ARP table", |
| 39 | ) |
| 40 | parser.add_argument( |
| 41 | "--override-port", |
| 42 | type=int, |
| 43 | metavar="PORT", |
| 44 | help="Override the default UDP port used to refresh the ARP table " |
| 45 | "if network requests are enabled and arping is unavailable", |
| 46 | ) |
| 47 | parser.add_argument( |
| 48 | "--override-platform", |
| 49 | type=str, |
| 50 | default=None, |
| 51 | metavar="PLATFORM", |
| 52 | help="Override the platform detection with the given value " |
| 53 | "(e.g. 'linux', 'windows', 'freebsd', etc.'). " |
| 54 | "Any values returned by platform.system() are valid.", |
| 55 | ) |
| 56 | parser.add_argument( |
| 57 | "--force-method", |
| 58 | type=str, |
| 59 | default=None, |
| 60 | metavar="METHOD", |
| 61 | help="Force a specific method to be used, e.g. 'IpNeighborShow'. " |
| 62 | "This will be used regardless of it's method type or platform " |
| 63 | "compatibility, and Method.test() will NOT be checked!", |
| 64 | ) |
| 65 | |
| 66 | group = parser.add_mutually_exclusive_group(required=False) |
| 67 | group.add_argument( |
| 68 | "-i", |
| 69 | "--interface", |
| 70 | type=str, |
no test coverage detected