no longer allowing entity-type url
This commit is contained in:
parent
6652cda610
commit
dc1964cd80
5 changed files with 15 additions and 14 deletions
|
@ -1,7 +1,7 @@
|
|||
usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
|
||||
[--time time] [--lineno LINENO] [--cursorpos CURSORPOS]
|
||||
[--entitytype ENTITY_TYPE] [--proxy PROXY] [--project PROJECT]
|
||||
[--alternate-project ALTERNATE_PROJECT]
|
||||
[--entity-type ENTITY_TYPE] [--proxy PROXY]
|
||||
[--project PROJECT] [--alternate-project ALTERNATE_PROJECT]
|
||||
[--alternate-language ALTERNATE_LANGUAGE]
|
||||
[--hostname HOSTNAME] [--disableoffline] [--hidefilenames]
|
||||
[--exclude EXCLUDE] [--include INCLUDE] [--extra-heartbeats]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
|
||||
[--time time] [--lineno LINENO] [--cursorpos CURSORPOS]
|
||||
[--entitytype ENTITY_TYPE] [--proxy PROXY] [--project PROJECT]
|
||||
[--alternate-project ALTERNATE_PROJECT]
|
||||
[--entity-type ENTITY_TYPE] [--proxy PROXY]
|
||||
[--project PROJECT] [--alternate-project ALTERNATE_PROJECT]
|
||||
[--alternate-language ALTERNATE_LANGUAGE]
|
||||
[--hostname HOSTNAME] [--disableoffline] [--hidefilenames]
|
||||
[--exclude EXCLUDE] [--include INCLUDE] [--extra-heartbeats]
|
||||
|
@ -25,9 +25,9 @@ optional arguments:
|
|||
--lineno LINENO optional line number; current line being edited
|
||||
--cursorpos CURSORPOS
|
||||
optional cursor position in the current file
|
||||
--entitytype ENTITY_TYPE
|
||||
--entity-type ENTITY_TYPE
|
||||
entity type for this heartbeat. can be one of "file",
|
||||
"url", "domain", or "app"; defaults to file.
|
||||
"domain", or "app"; defaults to file.
|
||||
--proxy PROXY optional https proxy url; for example:
|
||||
https://user:pass@localhost:8080
|
||||
--project PROJECT optional project name
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
|
||||
[--time time] [--lineno LINENO] [--cursorpos CURSORPOS]
|
||||
[--entitytype ENTITY_TYPE] [--proxy PROXY] [--project PROJECT]
|
||||
[--alternate-project ALTERNATE_PROJECT]
|
||||
[--entity-type ENTITY_TYPE] [--proxy PROXY]
|
||||
[--project PROJECT] [--alternate-project ALTERNATE_PROJECT]
|
||||
[--alternate-language ALTERNATE_LANGUAGE]
|
||||
[--hostname HOSTNAME] [--disableoffline] [--hidefilenames]
|
||||
[--exclude EXCLUDE] [--include INCLUDE] [--extra-heartbeats]
|
||||
|
|
|
@ -419,7 +419,7 @@ class BaseTestCase(utils.TestCase):
|
|||
config = 'tests/samples/configs/good_config.cfg'
|
||||
now = u(int(time.time()))
|
||||
|
||||
args = ['--entity', entity, '--entitytype', 'domain', '--config', config, '--time', now]
|
||||
args = ['--entity', entity, '--entity-type', 'domain', '--config', config, '--time', now]
|
||||
retval = execute(args)
|
||||
|
||||
self.assertEquals(retval, API_ERROR)
|
||||
|
@ -456,7 +456,7 @@ class BaseTestCase(utils.TestCase):
|
|||
config = 'tests/samples/configs/good_config.cfg'
|
||||
now = u(int(time.time()))
|
||||
|
||||
args = ['--entity', entity, '--entitytype', 'app', '--config', config, '--time', now]
|
||||
args = ['--entity', entity, '--entity-type', 'app', '--config', config, '--time', now]
|
||||
retval = execute(args)
|
||||
|
||||
self.assertEquals(retval, API_ERROR)
|
||||
|
|
|
@ -123,9 +123,9 @@ def parseArguments():
|
|||
help='optional line number; current line being edited')
|
||||
parser.add_argument('--cursorpos', dest='cursorpos',
|
||||
help='optional cursor position in the current file')
|
||||
parser.add_argument('--entitytype', dest='entity_type',
|
||||
parser.add_argument('--entity-type', dest='entity_type',
|
||||
help='entity type for this heartbeat. can be one of "file", '+
|
||||
'"url", "domain", or "app"; defaults to file.')
|
||||
'"domain", or "app"; defaults to file.')
|
||||
parser.add_argument('--proxy', dest='proxy',
|
||||
help='optional https proxy url; for example: '+
|
||||
'https://user:pass@localhost:8080')
|
||||
|
@ -193,8 +193,6 @@ def parseArguments():
|
|||
args.key = default_key
|
||||
else:
|
||||
parser.error('Missing api key')
|
||||
if not args.entity_type:
|
||||
args.entity_type = 'file'
|
||||
if not args.entity:
|
||||
if args.file:
|
||||
args.entity = args.file
|
||||
|
@ -464,6 +462,9 @@ def process_heartbeat(args, configs, hostname, heartbeat):
|
|||
))
|
||||
return SUCCESS
|
||||
|
||||
if heartbeat.get('entity_type') not in ['file', 'domain', 'app']:
|
||||
heartbeat['entity_type'] = 'file'
|
||||
|
||||
if heartbeat['entity_type'] != 'file' or os.path.isfile(heartbeat['entity']):
|
||||
|
||||
stats = get_file_stats(heartbeat['entity'],
|
||||
|
|
Loading…
Reference in a new issue