Skip to content

Commit 7b56f7a

Browse files
committed
fix bug where --version / -v wouldn't print version. remove superfluous logger msg
1 parent 10021b1 commit 7b56f7a

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ tmuxp Changelog
33

44
Here you can find the recent changes to tmuxp.
55

6+
2013-10-25
7+
----------
8+
9+
- [cli] fix bug where ``-v`` and ``--version`` wouldn't print version.
10+
611
2013-10-24
712
----------
813

tmuxp/cli.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,10 @@ def cli_parser():
354354
parser.add_argument('-S', dest='socket_path', default=None,
355355
metavar='socket-path')
356356

357+
# http://stackoverflow.com/questions/8521612/argparse-optional-subparser
357358
parser.add_argument(
358-
'-v', '--version', dest='version', action='store_true',
359+
'-v', '--version', action='version',
360+
version='tmuxp %s' % __version__,
359361
help='Prints the tmuxp version')
360362

361363
return parser
@@ -368,7 +370,7 @@ def main():
368370
args = parser.parse_args()
369371

370372
setupLogger(level=args.log_level.upper())
371-
logger.error('hi')
373+
372374
try:
373375
util.version()
374376
except Exception as e:
@@ -377,7 +379,10 @@ def main():
377379

378380
util.oh_my_zsh_auto_title()
379381

380-
if args.callback is subcommand_load:
382+
print (args)
383+
if args.version:
384+
print('tmuxp %s' % __version__)
385+
elif args.callback is subcommand_load:
381386
subcommand_load(args)
382387
elif args.callback is subcommand_convert:
383388
subcommand_convert(args)
@@ -386,9 +391,6 @@ def main():
386391
elif args.callback is subcommand_kill_session:
387392
subcommand_kill_session(args)
388393
else:
389-
if args.version:
390-
print('tmuxp %s' % __version__)
391-
392394
parser.print_help()
393395

394396

0 commit comments

Comments
 (0)