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 ? ## Issues ?
* Multiplication of {{}} => solved in bibtexparser * Multiplication of {{}} => solved in bibtexparser
* UTF-8 and bibtexparser => solved upstream
* delete
## Thanks ## Thanks

View File

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

View File

@ -417,13 +417,13 @@ if __name__ == '__main__':
parser_resync.set_defaults(func='resync') parser_resync.set_defaults(func='resync')
parser_update = subparsers.add_parser('update', help="update help") 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") help="a filename or an identifier")
parser_update.set_defaults(func='update') parser_update.set_defaults(func='update')
parser_search = subparsers.add_parser('search', help="search help") parser_search = subparsers.add_parser('search', help="search help")
# TODO: Check # 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.") help="your query, see README for more info.")
parser_search.set_defaults(func='search') parser_search.set_defaults(func='search')