diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-01-19 20:22:29 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-01-19 20:22:29 +0000 |
commit | e5cf4ec31dbd7ddd8b4a97b7da2595f860015726 (patch) | |
tree | 9f24bac835122a278d9ee85e37953a954f9a4fae /cliapp/app.py | |
parent | 1c39096b777c4d704dbf96437e35a008cd50ab4c (diff) | |
download | cliapp-e5cf4ec31dbd7ddd8b4a97b7da2595f860015726.tar.gz |
Obey COLUMNS for help output
Diffstat (limited to 'cliapp/app.py')
-rw-r--r-- | cliapp/app.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cliapp/app.py b/cliapp/app.py index b0106ee..e01d48a 100644 --- a/cliapp/app.py +++ b/cliapp/app.py @@ -261,7 +261,12 @@ class Application(object): def help(self, args): # pragma: no cover '''Print help.''' - fmt = cliapp.TextFormat(width=78) + try: + width = int(os.environ.get('COLUMNS', '78')) + except ValueError: + width = 78 + + fmt = cliapp.TextFormat(width=width) usage = self._format_usage() description = fmt.format(self._format_description()) text = '%s\n\n%s' % (usage, description) |