Fixes in argparse
This commit is contained in:
parent
681283a0db
commit
c8054e2c67
@ -123,6 +123,8 @@ Tree à la docear ?
|
||||
## Issues ?
|
||||
|
||||
* Multiplication of {{}} => solved in bibtexparser
|
||||
* UTF-8 and bibtexparser => solved upstream
|
||||
* delete
|
||||
|
||||
## Thanks
|
||||
|
||||
|
12
backend.py
12
backend.py
@ -159,26 +159,26 @@ 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'])
|
||||
except:
|
||||
tools.warning("Unable to delete file associated to id " +
|
||||
key+" : "+bibtex[key]['file'])
|
||||
key+" : "+bibtex[key]['file'])
|
||||
|
||||
try:
|
||||
if not os.listdir(os.path.dirname(filename)):
|
||||
os.rmdir(os.path.dirname(filename))
|
||||
except:
|
||||
tools.warning("Unable to delete empty tag dir " +
|
||||
os.path.dirname(filename))
|
||||
os.path.dirname(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
|
||||
|
4
main.py
4
main.py
@ -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')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user