1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
From 7414634a11c61268a98edd26a4de2d65cb44a28b Mon Sep 17 00:00:00 2001
From: Alejandro Gallo <aamsgallo@gmail.com>
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)
|