Skip to content

Commit

Permalink
[deal_with_command_line_arg.py]: update
Browse files Browse the repository at this point in the history
  • Loading branch information
chenrushan committed Apr 28, 2016
1 parent acae092 commit 302c59d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/deal_with_command_line_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@

if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Help iSCSI deployment.')
# choices 就是这个选项只能取 choices 数组中给出的值
parser.add_argument('-s', '--service', choices=['target', 'initiator'],
default=None, help='type of service deployment')
parser.add_argument('--test', action='store_true', default=False,
help='Test the code against a local mkcloud installation')
args = parser.parse_args()

print args.service
if args.test:
print "test is true"

0 comments on commit 302c59d

Please sign in to comment.