upgrade wakatime cli to v4.0.9

This commit is contained in:
Alan Hamlett 2015-05-06 15:45:34 -07:00
parent 762027644f
commit bfcc242d7e
3 changed files with 9 additions and 3 deletions

View file

@ -1,7 +1,7 @@
__title__ = 'wakatime'
__description__ = 'Common interface to the WakaTime api.'
__url__ = 'https://github.com/wakatime/wakatime'
__version_info__ = ('4', '0', '8')
__version_info__ = ('4', '0', '9')
__version__ = '.'.join(__version_info__)
__author__ = 'Alan Hamlett'
__author_email__ = 'alan@wakatime.com'

View file

@ -147,6 +147,8 @@ def parseArguments(argv):
type=float,
help='optional floating-point unix epoch timestamp; '+
'uses current time by default')
parser.add_argument('--lineno', dest='lineno',
help='optional line number; current line being edited')
parser.add_argument('--notfile', dest='notfile', action='store_true',
help='when set, will accept any value for the file. for example, '+
'a domain name or other item you want to log time towards.')
@ -322,6 +324,8 @@ def send_heartbeat(project=None, branch=None, stats={}, key=None, targetFile=Non
data['language'] = stats['language']
if stats.get('dependencies'):
data['dependencies'] = stats['dependencies']
if stats.get('lineno'):
data['lineno'] = stats['lineno']
if isWrite:
data['is_write'] = isWrite
if project:
@ -424,7 +428,7 @@ def main(argv=None):
if os.path.isfile(args.targetFile) or args.notfile:
stats = get_file_stats(args.targetFile, notfile=args.notfile)
stats = get_file_stats(args.targetFile, notfile=args.notfile, lineno=args.lineno)
project = None
if not args.notfile:

View file

@ -86,12 +86,13 @@ def number_lines_in_file(file_name):
return lines
def get_file_stats(file_name, notfile=False):
def get_file_stats(file_name, notfile=False, lineno=None):
if notfile:
stats = {
'language': None,
'dependencies': [],
'lines': None,
'lineno': lineno,
}
else:
language, lexer = guess_language(file_name)
@ -101,5 +102,6 @@ def get_file_stats(file_name, notfile=False):
'language': language,
'dependencies': dependencies,
'lines': number_lines_in_file(file_name),
'lineno': lineno,
}
return stats