Fixes in argparse

This commit is contained in:
Phyks 2014-05-09 23:50:19 +02:00
parent 681283a0db
commit c8054e2c67
3 changed files with 10 additions and 8 deletions

View File

@ -123,6 +123,8 @@ Tree à la docear ?
## Issues ?
* Multiplication of {{}} => solved in bibtexparser
* UTF-8 and bibtexparser => solved upstream
* delete
## Thanks

View File

@ -159,7 +159,7 @@ def deleteFile(filename):
found = False
for key in bibtex.keys():
if os.path.samepath(bibtex[key]['file'], filename):
if os.path.samefile(bibtex[key]['file'], filename):
found = True
try:
os.remove(bibtex[key]['file'])
@ -177,8 +177,8 @@ def deleteFile(filename):
try:
del(bibtex[key])
except KeyError:
tools.warning("No associated bibtex entry in index for file " +
bibtex[key]['file'])
tools.warning("No associated bibtex entry in index for " +
"file " + bibtex[key]['file'])
if found:
bibtexRewrite(bibtex)
return found
@ -236,7 +236,7 @@ def getBibtex(entry, file_id='both'):
pass
elif file_id == 'both' or file_id == 'file':
for key in bibtex.keys():
if os.path.samepath(bibtex[key]['file'], entry):
if os.path.samefile(bibtex[key]['file'], entry):
bibtex_entry = bibtex[key]
break
return bibtex_entry

View File

@ -417,13 +417,13 @@ if __name__ == '__main__':
parser_resync.set_defaults(func='resync')
parser_update = subparsers.add_parser('update', help="update help")
parser_delete.add_argument('--entries', metavar='entry', nargs='+',
parser_update.add_argument('--entries', metavar='entry', nargs='+',
help="a filename or an identifier")
parser_update.set_defaults(func='update')
parser_search = subparsers.add_parser('search', help="search help")
# TODO: Check
parser_delete.add_argument('query', metavar='entry', nargs='+',
parser_search.add_argument('query', metavar='entry', nargs='+',
help="your query, see README for more info.")
parser_search.set_defaults(func='search')