use language as extra heartbeats key name
This commit is contained in:
parent
7ec1f7c5f4
commit
da3cf30ddd
5 changed files with 19 additions and 22 deletions
|
@ -2,9 +2,8 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
|
||||||
[--time time] [--lineno LINENO] [--cursorpos CURSORPOS]
|
[--time time] [--lineno LINENO] [--cursorpos CURSORPOS]
|
||||||
[--entity-type ENTITY_TYPE] [--proxy PROXY]
|
[--entity-type ENTITY_TYPE] [--proxy PROXY]
|
||||||
[--project PROJECT] [--alternate-project ALTERNATE_PROJECT]
|
[--project PROJECT] [--alternate-project ALTERNATE_PROJECT]
|
||||||
[--language ALTERNATE_LANGUAGE] [--hostname HOSTNAME]
|
[--language LANGUAGE] [--hostname HOSTNAME] [--disableoffline]
|
||||||
[--disableoffline] [--hidefilenames] [--exclude EXCLUDE]
|
[--hidefilenames] [--exclude EXCLUDE] [--include INCLUDE]
|
||||||
[--include INCLUDE] [--extra-heartbeats] [--logfile LOGFILE]
|
[--extra-heartbeats] [--logfile LOGFILE] [--apiurl API_URL]
|
||||||
[--apiurl API_URL] [--timeout TIMEOUT] [--config CONFIG]
|
[--timeout TIMEOUT] [--config CONFIG] [--verbose] [--version]
|
||||||
[--verbose] [--version]
|
|
||||||
wakatime: error: argument --timeout: invalid int value: 'abc'
|
wakatime: error: argument --timeout: invalid int value: 'abc'
|
||||||
|
|
|
@ -2,11 +2,10 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
|
||||||
[--time time] [--lineno LINENO] [--cursorpos CURSORPOS]
|
[--time time] [--lineno LINENO] [--cursorpos CURSORPOS]
|
||||||
[--entity-type ENTITY_TYPE] [--proxy PROXY]
|
[--entity-type ENTITY_TYPE] [--proxy PROXY]
|
||||||
[--project PROJECT] [--alternate-project ALTERNATE_PROJECT]
|
[--project PROJECT] [--alternate-project ALTERNATE_PROJECT]
|
||||||
[--language ALTERNATE_LANGUAGE] [--hostname HOSTNAME]
|
[--language LANGUAGE] [--hostname HOSTNAME] [--disableoffline]
|
||||||
[--disableoffline] [--hidefilenames] [--exclude EXCLUDE]
|
[--hidefilenames] [--exclude EXCLUDE] [--include INCLUDE]
|
||||||
[--include INCLUDE] [--extra-heartbeats] [--logfile LOGFILE]
|
[--extra-heartbeats] [--logfile LOGFILE] [--apiurl API_URL]
|
||||||
[--apiurl API_URL] [--timeout TIMEOUT] [--config CONFIG]
|
[--timeout TIMEOUT] [--config CONFIG] [--verbose] [--version]
|
||||||
[--verbose] [--version]
|
|
||||||
|
|
||||||
Common interface for the WakaTime api.
|
Common interface for the WakaTime api.
|
||||||
|
|
||||||
|
@ -35,9 +34,8 @@ optional arguments:
|
||||||
--alternate-project ALTERNATE_PROJECT
|
--alternate-project ALTERNATE_PROJECT
|
||||||
optional alternate project name; auto-discovered
|
optional alternate project name; auto-discovered
|
||||||
project takes priority
|
project takes priority
|
||||||
--language ALTERNATE_LANGUAGE
|
--language LANGUAGE optional language name; if valid, takes priority over
|
||||||
optional alternate language name; if valid, takes
|
auto-detected language
|
||||||
priority over auto-detected language
|
|
||||||
--hostname HOSTNAME hostname of current machine.
|
--hostname HOSTNAME hostname of current machine.
|
||||||
--disableoffline disables offline time logging instead of queuing
|
--disableoffline disables offline time logging instead of queuing
|
||||||
logged time
|
logged time
|
||||||
|
|
|
@ -81,11 +81,11 @@ def parseArguments():
|
||||||
parser.add_argument('--alternate-project', dest='alternate_project',
|
parser.add_argument('--alternate-project', dest='alternate_project',
|
||||||
help='optional alternate project name; auto-discovered project '+
|
help='optional alternate project name; auto-discovered project '+
|
||||||
'takes priority')
|
'takes priority')
|
||||||
parser.add_argument('--alternate-language', dest='alternate_language_old',
|
parser.add_argument('--alternate-language', dest='alternate_language',
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
parser.add_argument('--language', dest='alternate_language',
|
parser.add_argument('--language', dest='language',
|
||||||
help='optional alternate language name; if valid, takes priority '+
|
help='optional language name; if valid, takes priority over '+
|
||||||
'over auto-detected language')
|
'auto-detected language')
|
||||||
parser.add_argument('--hostname', dest='hostname', help='hostname of '+
|
parser.add_argument('--hostname', dest='hostname', help='hostname of '+
|
||||||
'current machine.')
|
'current machine.')
|
||||||
parser.add_argument('--disableoffline', dest='offline',
|
parser.add_argument('--disableoffline', dest='offline',
|
||||||
|
@ -162,8 +162,8 @@ def parseArguments():
|
||||||
else:
|
else:
|
||||||
parser.error('argument --entity is required')
|
parser.error('argument --entity is required')
|
||||||
|
|
||||||
if not args.alternate_language and args.alternate_language_old:
|
if not args.language and args.alternate_language:
|
||||||
args.alternate_language = args.alternate_language_old
|
args.language = args.alternate_language
|
||||||
|
|
||||||
if not args.exclude:
|
if not args.exclude:
|
||||||
args.exclude = []
|
args.exclude = []
|
||||||
|
|
|
@ -262,7 +262,7 @@ def process_heartbeat(args, configs, hostname, heartbeat):
|
||||||
lineno=heartbeat.get('lineno'),
|
lineno=heartbeat.get('lineno'),
|
||||||
cursorpos=heartbeat.get('cursorpos'),
|
cursorpos=heartbeat.get('cursorpos'),
|
||||||
plugin=args.plugin,
|
plugin=args.plugin,
|
||||||
alternate_language=heartbeat.get('alternate_language'))
|
language=heartbeat.get('language'))
|
||||||
|
|
||||||
project = heartbeat.get('project') or heartbeat.get('alternate_project')
|
project = heartbeat.get('project') or heartbeat.get('alternate_project')
|
||||||
branch = None
|
branch = None
|
||||||
|
|
|
@ -34,7 +34,7 @@ log = logging.getLogger('WakaTime')
|
||||||
|
|
||||||
|
|
||||||
def get_file_stats(file_name, entity_type='file', lineno=None, cursorpos=None,
|
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':
|
if entity_type != 'file':
|
||||||
stats = {
|
stats = {
|
||||||
'language': None,
|
'language': None,
|
||||||
|
@ -44,7 +44,7 @@ def get_file_stats(file_name, entity_type='file', lineno=None, cursorpos=None,
|
||||||
'cursorpos': cursorpos,
|
'cursorpos': cursorpos,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
language = standardize_language(alternate_language, plugin)
|
language = standardize_language(language, plugin)
|
||||||
lexer = get_lexer(language)
|
lexer = get_lexer(language)
|
||||||
|
|
||||||
if not language:
|
if not language:
|
||||||
|
|
Loading…
Reference in a new issue