From 7414634a11c61268a98edd26a4de2d65cb44a28b Mon Sep 17 00:00:00 2001 From: Alejandro Gallo Date: Sat, 29 Sep 2018 12:52:01 +0200 Subject: [PATCH] Fix issue #110 Thank you @ARamsey118 and @zamlz ! --- papis/commands/add.py | 18 +++++++++--------- papis/commands/default.py | 14 ++++++++------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/papis/commands/add.py b/papis/commands/add.py index e25e330..57985c9 100644 --- a/papis/commands/add.py +++ b/papis/commands/add.py @@ -536,13 +536,13 @@ def run( @click.help_option('--help', '-h') @click.argument("files", type=click.Path(exists=True), nargs=-1) @click.option( - "-s", "--set", + "-s", "--set", "set_list", help="Set some information before", multiple=True, type=(str, str) ) @click.option( - "-d", "--dir", + "-d", "--dir", "directory", help="Subfolder in the library", default="" ) @@ -604,7 +604,7 @@ def run( default=lambda: True if papis.config.get('add-confirm') else False ) @click.option( - "--open/--no-open", + "--open/--no-open", "open_file", help="Open file before adding document", default=lambda: True if papis.config.get('add-open') else False ) @@ -632,8 +632,8 @@ def run( ) def cli( files, - set, - dir, + set_list, + directory, interactive, name, file_name, @@ -645,7 +645,7 @@ def cli( from_pmid, from_lib, confirm, - open, + open_file, edit, commit, link, @@ -655,7 +655,7 @@ def cli( """ data = dict() - for data_set in set: + for data_set in set_list: data[data_set[0]] = data_set[1] logger = logging.getLogger('cli:add') @@ -694,7 +694,7 @@ def cli( data=data, name=name, file_name=file_name, - subfolder=dir, + subfolder=directory, interactive=interactive, from_bibtex=from_bibtex, from_yaml=from_yaml, @@ -703,7 +703,7 @@ def cli( from_doi=from_doi, from_pmid=from_pmid, confirm=confirm, - open_file=open, + open_file=open_file, edit=edit, commit=commit, link=link, diff --git a/papis/commands/default.py b/papis/commands/default.py index 791e134..dc5e2c3 100644 --- a/papis/commands/default.py +++ b/papis/commands/default.py @@ -74,7 +74,7 @@ import papis.cli is_flag=True ) @click.option( - "--clear-cache", "--cc", + "--cc", "--clear-cache", "clear_cache", help="Clear cache of the library used", default=False, is_flag=True @@ -86,7 +86,7 @@ import papis.cli default=__import__("multiprocessing").cpu_count(), ) @click.option( - "-s", "--set", + "-s", "--set", "set_list", type=(str, str), multiple=True, help="Set key value, e.g., " @@ -98,9 +98,9 @@ def run( lib, log, pick_lib, - cc, + clear_cache, cores, - set + set_list ): log_format = '%(levelname)s:%(name)s:%(message)s' if verbose: @@ -110,8 +110,10 @@ def run( level=getattr(logging, log), format=log_format ) + logger = logging.getLogger('default') - for pair in set: + for pair in set_list: + logger.debug('Setting "{0}" to "{1}"'.format(*pair)) papis.config.set(pair[0], pair[1]) if config: @@ -140,5 +142,5 @@ def run( papis.config.get_configuration() ) - if cc: + if clear_cache: papis.api.clear_lib_cache(lib)