Skip to content

Commit

Permalink
fix bug where --version / -v wouldn't print version. remove superfluo…
Browse files Browse the repository at this point in the history
…us logger msg
  • Loading branch information
tony committed Oct 24, 2013
1 parent 10021b1 commit 7b56f7a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ tmuxp Changelog

Here you can find the recent changes to tmuxp.

2013-10-25
----------

- [cli] fix bug where ``-v`` and ``--version`` wouldn't print version.

2013-10-24
----------

Expand Down
14 changes: 8 additions & 6 deletions tmuxp/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,10 @@ def cli_parser():
parser.add_argument('-S', dest='socket_path', default=None,
metavar='socket-path')

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

return parser
Expand All @@ -368,7 +370,7 @@ def main():
args = parser.parse_args()

setupLogger(level=args.log_level.upper())
logger.error('hi')

try:
util.version()
except Exception as e:
Expand All @@ -377,7 +379,10 @@ def main():

util.oh_my_zsh_auto_title()

if args.callback is subcommand_load:
print (args)
if args.version:
print('tmuxp %s' % __version__)
elif args.callback is subcommand_load:
subcommand_load(args)
elif args.callback is subcommand_convert:
subcommand_convert(args)
Expand All @@ -386,9 +391,6 @@ def main():
elif args.callback is subcommand_kill_session:
subcommand_kill_session(args)
else:
if args.version:
print('tmuxp %s' % __version__)

parser.print_help()


Expand Down

0 comments on commit 7b56f7a

Please sign in to comment.