Adds tags command to list tags.
This commit is contained in:
parent
16c43f84e3
commit
e404c9e5b3
@ -8,3 +8,4 @@ import open_cmd
|
||||
import edit_cmd
|
||||
import remove_cmd
|
||||
import websearch_cmd
|
||||
import tags_cmd
|
||||
|
@ -19,7 +19,8 @@ cmds = collections.OrderedDict([
|
||||
('edit', commands.edit_cmd),
|
||||
('remove', commands.remove_cmd),
|
||||
('open', commands.open_cmd),
|
||||
('websearch', commands.websearch_cmd)
|
||||
('websearch', commands.websearch_cmd),
|
||||
('tags', commands.tags_cmd),
|
||||
])
|
||||
|
||||
config = configs.read_config()
|
||||
|
@ -174,7 +174,8 @@ class Repository(object):
|
||||
|
||||
def get_document_directory(self):
|
||||
if self.config.has_option(configs.MAIN_SECTION, 'document-directory'):
|
||||
doc_dir = self.config.get(configs.MAIN_SECTION, 'document-directory')
|
||||
doc_dir = self.config.get(configs.MAIN_SECTION,
|
||||
'document-directory')
|
||||
else:
|
||||
doc_dir = os.path.join(self.papersdir, DOC_DIR)
|
||||
return files.clean_path(doc_dir)
|
||||
@ -203,6 +204,12 @@ class Repository(object):
|
||||
new_doc_file = os.path.join(doc_path, citekey + ext)
|
||||
shutil.copy(doc_file, new_doc_file)
|
||||
|
||||
def get_labels(self):
|
||||
labels = set()
|
||||
for p in self.all_papers():
|
||||
labels = labels.union(p.metadata.get('labels', []))
|
||||
return labels
|
||||
|
||||
@classmethod
|
||||
def from_directory(cls, config, papersdir=None):
|
||||
repo = cls(config=config)
|
||||
|
Loading…
x
Reference in New Issue
Block a user