api/examples: Simplify optparse use
- The default 'default' is None - The default 'dest' is the option name, with - replaced with _ - The default 'action' is 'store' Not coincidentally, these defaults are correct for most of our existing code. (imported from commit 9c6078bd778324e08e1ca214a97281a7bdce08c2)
This commit is contained in:
parent
dd80275354
commit
b65ce435c4
7 changed files with 24 additions and 90 deletions
|
@ -32,17 +32,9 @@ Prints out all the public streams in the realm.
|
|||
Example: get-public-streams --user=tabbott@humbughq.com --site=https://zephyr.humbughq.com
|
||||
"""
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
parser.add_option('--site',
|
||||
dest='site',
|
||||
default="https://humbughq.com",
|
||||
action='store')
|
||||
parser.add_option('--api-key',
|
||||
dest='api_key',
|
||||
default=None,
|
||||
action='store')
|
||||
parser.add_option('--user',
|
||||
dest='user',
|
||||
action='store')
|
||||
parser.add_option('--site', default='https://humbughq.com')
|
||||
parser.add_option('--api-key')
|
||||
parser.add_option('--user')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '../..'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue