Created
February 18, 2014 11:39
-
-
Save aliles/9069387 to your computer and use it in GitHub Desktop.
Example CLI help output for possible re-implementation of boolean flags for begins.
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
from flask import Flask | |
import begin | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Hello World!' | |
@begin.start(env_prefix='WEB_') | |
@begin.convert(port=int, debug=begin.utils.tobool) | |
def main(host='127.0.0.1', port=8080, debug=False): | |
app.run(host=host, port=port, debug=debug) |
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
$ WEB_DEBUG=false python flask_quickstart.py --help | |
usage: flask_quickstart.py [--help] [--host WEB_HOST] [--port WEB_PORT] | |
[--debug] [--no-debug] | |
optional arguments: | |
--help show this help message and exit | |
--host WEB_HOST, -h WEB_HOST | |
(default: 127.0.0.1) | |
--port WEB_PORT, -p WEB_PORT | |
(default: 8080) | |
--debug (default: False) | |
--no-debug |
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
$ WEB_DEBUG=true python flask_quickstart.py --help | |
usage: flask_quickstart.py [--help] [--host WEB_HOST] [--port WEB_PORT] | |
[--debug] [--no-debug] | |
optional arguments: | |
--help show this help message and exit | |
--host WEB_HOST, -h WEB_HOST | |
(default: 127.0.0.1) | |
--port WEB_PORT, -p WEB_PORT | |
(default: 8080) | |
--debug | |
--no-debug (default: True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment