Rename option -v/--verbose to -d/--debug, add option -v/--version in qweechat-testproto

This commit is contained in:
Sébastien Helleu 2014-05-08 18:13:15 +02:00
parent 661b2993c9
commit 438f63fac2

View file

@ -37,6 +37,7 @@ import time
import traceback import traceback
import protocol # WeeChat/relay protocol import protocol # WeeChat/relay protocol
from .. version import qweechat_version
NAME = 'qweechat-testproto' NAME = 'qweechat-testproto'
@ -93,10 +94,10 @@ class TestProto(object):
try: try:
proto = protocol.Protocol() proto = protocol.Protocol()
msgd = proto.decode(message, msgd = proto.decode(message,
separator='\n' if self.args.verbose > 0 separator='\n' if self.args.debug > 0
else ', ') else ', ')
print('') print('')
if self.args.verbose >= 2 and msgd.uncompressed: if self.args.debug >= 2 and msgd.uncompressed:
# display raw message # display raw message
print('\x1b[32m--> message uncompressed ({0} bytes):\n' print('\x1b[32m--> message uncompressed ({0} bytes):\n'
'{1}\x1b[0m' '{1}\x1b[0m'
@ -215,9 +216,11 @@ The script returns:
'''.format(name=NAME)) '''.format(name=NAME))
parser.add_argument('-6', '--ipv6', action='store_true', parser.add_argument('-6', '--ipv6', action='store_true',
help='connect using IPv6') help='connect using IPv6')
parser.add_argument('-v', '--verbose', action='count', default=0, parser.add_argument('-d', '--debug', action='count', default=0,
help='verbose mode: long objects view ' help='debug mode: long objects view '
'(-vv: display raw messages)') '(-dd: display raw messages)')
parser.add_argument('-v', '--version', action='version',
version=qweechat_version())
parser.add_argument('hostname', parser.add_argument('hostname',
help='hostname (or IP address) of machine running ' help='hostname (or IP address) of machine running '
'WeeChat/relay') 'WeeChat/relay')