Skip to content

Commit c1009fd

Browse files
committed
Declared option defaults in help text.
1 parent c3d0b50 commit c1009fd

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

‎beeswithmachineguns/main.py‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ def parse_options():
5151

5252
up_group.add_option('-s', '--servers', metavar="SERVERS", nargs=1,
5353
action='store', dest='servers', type='int', default=5,
54-
help="number of servers to start")
54+
help="number of servers to start (default: 5)")
5555
up_group.add_option('-g', '--group', metavar="GROUP", nargs=1,
5656
action='store', dest='group', type='string', default='staging',
57-
help="the security group to run the instances under")
57+
help="the security group to run the instances under (default: staging)")
5858
up_group.add_option('-z', '--zone', metavar="ZONE", nargs=1,
5959
action='store', dest='zone', type='string', default='us-east-1d',
60-
help="the availability zone to start the instances in (e.g. us-east-1d)")
60+
help="the availability zone to start the instances in (default: us-east-1d)")
6161
up_group.add_option('-i', '--instance', metavar="INSTANCE", nargs=1,
6262
action='store', dest='instance', type='string', default='ami-ff17fb96',
63-
help="the instance-id to start each server from (e.g. ami-ff17fb96)")
63+
help="the instance-id to start each server from (default ami-ff17fb96)")
6464
up_group.add_option('-k', '--key', metavar="KEY", nargs=1,
65-
action='store', dest='key', type='string', default='frakkingtoasters',
65+
action='store', dest='key', type='string',
6666
help="the ssh key pair name to use to connect to the new servers")
6767

6868
parser.add_option_group(up_group)
@@ -71,11 +71,11 @@ def parse_options():
7171

7272
attack_group.add_option('-n', '--number', metavar="NUMBER", nargs=1,
7373
action='store', dest='number', type='int', default=1000,
74-
help="number of total connections to make to the target")
74+
help="number of total connections to make to the target (default: 1000)")
7575

7676
attack_group.add_option('-c', '--concurrent', metavar="CONCURRENT", nargs=1,
7777
action='store', dest='concurrent', type='int', default=100,
78-
help="number of concurrent connections to make to the target")
78+
help="number of concurrent connections to make to the target (default: 100)")
7979

8080
attack_group.add_option('-u', '--url', metavar="URL", nargs=1,
8181
action='store', dest='url', type='string',
@@ -91,10 +91,13 @@ def parse_options():
9191
command=args[0]
9292

9393
ifcommand=="up":
94+
ifnotoptions.key:
95+
parser.error('To spin up new instances you need to specify a key-pair name with -k')
96+
9497
bees.up(options.servers, options.group, options.zone, options.instance, options.key)
9598
elifcommand=="attack":
96-
if'url'notinoptions:
97-
parser.error("To run an attack you need to specify a url")
99+
ifnotoptions.url:
100+
parser.error("To run an attack you need to specify a url with -u")
98101

99102
bees.attack(options.url, options.number, options.concurrency)
100103
elifcommand=="down":

0 commit comments

Comments
(0)