use language as extra heartbeats key name

This commit is contained in:
Alan Hamlett 2017-02-20 15:29:44 -08:00
parent 7ec1f7c5f4
commit da3cf30ddd
5 changed files with 19 additions and 22 deletions

View file

@ -2,9 +2,8 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
[--time time] [--lineno LINENO] [--cursorpos CURSORPOS]
[--entity-type ENTITY_TYPE] [--proxy PROXY]
[--project PROJECT] [--alternate-project ALTERNATE_PROJECT]
[--language ALTERNATE_LANGUAGE] [--hostname HOSTNAME]
[--disableoffline] [--hidefilenames] [--exclude EXCLUDE]
[--include INCLUDE] [--extra-heartbeats] [--logfile LOGFILE]
[--apiurl API_URL] [--timeout TIMEOUT] [--config CONFIG]
[--verbose] [--version]
[--language LANGUAGE] [--hostname HOSTNAME] [--disableoffline]
[--hidefilenames] [--exclude EXCLUDE] [--include INCLUDE]
[--extra-heartbeats] [--logfile LOGFILE] [--apiurl API_URL]
[--timeout TIMEOUT] [--config CONFIG] [--verbose] [--version]
wakatime: error: argument --timeout: invalid int value: 'abc'

View file

@ -2,11 +2,10 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
[--time time] [--lineno LINENO] [--cursorpos CURSORPOS]
[--entity-type ENTITY_TYPE] [--proxy PROXY]
[--project PROJECT] [--alternate-project ALTERNATE_PROJECT]
[--language ALTERNATE_LANGUAGE] [--hostname HOSTNAME]
[--disableoffline] [--hidefilenames] [--exclude EXCLUDE]
[--include INCLUDE] [--extra-heartbeats] [--logfile LOGFILE]
[--apiurl API_URL] [--timeout TIMEOUT] [--config CONFIG]
[--verbose] [--version]
[--language LANGUAGE] [--hostname HOSTNAME] [--disableoffline]
[--hidefilenames] [--exclude EXCLUDE] [--include INCLUDE]
[--extra-heartbeats] [--logfile LOGFILE] [--apiurl API_URL]
[--timeout TIMEOUT] [--config CONFIG] [--verbose] [--version]
Common interface for the WakaTime api.
@ -35,9 +34,8 @@ optional arguments:
--alternate-project ALTERNATE_PROJECT
optional alternate project name; auto-discovered
project takes priority
--language ALTERNATE_LANGUAGE
optional alternate language name; if valid, takes
priority over auto-detected language
--language LANGUAGE optional language name; if valid, takes priority over
auto-detected language
--hostname HOSTNAME hostname of current machine.
--disableoffline disables offline time logging instead of queuing
logged time

View file

@ -81,11 +81,11 @@ def parseArguments():
parser.add_argument('--alternate-project', dest='alternate_project',
help='optional alternate project name; auto-discovered project '+
'takes priority')
parser.add_argument('--alternate-language', dest='alternate_language_old',
parser.add_argument('--alternate-language', dest='alternate_language',
help=argparse.SUPPRESS)
parser.add_argument('--language', dest='alternate_language',
help='optional alternate language name; if valid, takes priority '+
'over auto-detected language')
parser.add_argument('--language', dest='language',
help='optional language name; if valid, takes priority over '+
'auto-detected language')
parser.add_argument('--hostname', dest='hostname', help='hostname of '+
'current machine.')
parser.add_argument('--disableoffline', dest='offline',
@ -162,8 +162,8 @@ def parseArguments():
else:
parser.error('argument --entity is required')
if not args.alternate_language and args.alternate_language_old:
args.alternate_language = args.alternate_language_old
if not args.language and args.alternate_language:
args.language = args.alternate_language
if not args.exclude:
args.exclude = []

View file

@ -262,7 +262,7 @@ def process_heartbeat(args, configs, hostname, heartbeat):
lineno=heartbeat.get('lineno'),
cursorpos=heartbeat.get('cursorpos'),
plugin=args.plugin,
alternate_language=heartbeat.get('alternate_language'))
language=heartbeat.get('language'))
project = heartbeat.get('project') or heartbeat.get('alternate_project')
branch = None

View file

@ -34,7 +34,7 @@ log = logging.getLogger('WakaTime')
def get_file_stats(file_name, entity_type='file', lineno=None, cursorpos=None,
plugin=None, alternate_language=None):
plugin=None, language=None):
if entity_type != 'file':
stats = {
'language': None,
@ -44,7 +44,7 @@ def get_file_stats(file_name, entity_type='file', lineno=None, cursorpos=None,
'cursorpos': cursorpos,
}
else:
language = standardize_language(alternate_language, plugin)
language = standardize_language(language, plugin)
lexer = get_lexer(language)
if not language: