Fixes in argparse
This commit is contained in:
parent
681283a0db
commit
c8054e2c67
@ -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
|
||||||
|
|
||||||
|
12
backend.py
12
backend.py
@ -159,26 +159,26 @@ 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'])
|
||||||
except:
|
except:
|
||||||
tools.warning("Unable to delete file associated to id " +
|
tools.warning("Unable to delete file associated to id " +
|
||||||
key+" : "+bibtex[key]['file'])
|
key+" : "+bibtex[key]['file'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not os.listdir(os.path.dirname(filename)):
|
if not os.listdir(os.path.dirname(filename)):
|
||||||
os.rmdir(os.path.dirname(filename))
|
os.rmdir(os.path.dirname(filename))
|
||||||
except:
|
except:
|
||||||
tools.warning("Unable to delete empty tag dir " +
|
tools.warning("Unable to delete empty tag dir " +
|
||||||
os.path.dirname(filename))
|
os.path.dirname(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
|
||||||
|
4
main.py
4
main.py
@ -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')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user