Created
April 4, 2016 19:11
-
-
Save agusmakmun/2cbec6b839de4188b01964bd3919a445 to your computer and use it in GitHub Desktop.
argparse example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
parser = argparse.ArgumentParser(description='Help iSCSI deployment.') | |
parser.add_argument('-s', '--service', choices=['target', 'initiator'], | |
default=None, | |
help='type of service deployment') | |
parser.add_argument('-o', '--host', default=None, | |
help='Host address for the machine to configure') | |
parser.add_argument('-t', '--target_host', default=None, | |
help='Host address where the initiator search the target') | |
parser.add_argument('-d', '--device', default='/dev/loop0', | |
help='Device for the target (/dev/loop0)') | |
parser.add_argument('--id', default='id01', | |
help='Suffix ID for the iSCSI name') | |
parser.add_argument('--test', action='store_true', default=False, | |
help='Test the code against a local mkcloud installation') | |
args = parser.parse_args() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment