From c8054e2c6714ff694e36caf1aec0bae51071b67c Mon Sep 17 00:00:00 2001 From: Phyks Date: Fri, 9 May 2014 23:50:19 +0200 Subject: [PATCH] Fixes in argparse --- README.md | 2 ++ backend.py | 12 ++++++------ main.py | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 78afd96..d6a97c3 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,8 @@ Tree à la docear ? ## Issues ? * Multiplication of {{}} => solved in bibtexparser +* UTF-8 and bibtexparser => solved upstream +* delete ## Thanks diff --git a/backend.py b/backend.py index 0bd0f55..fced60f 100644 --- a/backend.py +++ b/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 diff --git a/main.py b/main.py index 558423d..225a4c6 100755 --- a/main.py +++ b/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')