summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lesana/command.py16
-rwxr-xr-xscripts/lesana3
2 files changed, 17 insertions, 2 deletions
diff --git a/lesana/command.py b/lesana/command.py
index e6dbce8..e900aad 100644
--- a/lesana/command.py
+++ b/lesana/command.py
@@ -11,7 +11,21 @@ class New(gadona.Command):
]
def main(self):
- collection = Collection()
+ collection = Collection(self.settings.collection)
new_entry = Entry(collection)
collection.save_entries([new_entry])
print(new_entry.fname)
+
+
+class Index(gadona.Command):
+ name = 'index'
+ arguments = [
+ (['--collection', '-c'], dict(
+ help='The collection to work on (default .)'
+ )),
+ ]
+
+ def main(self):
+ collection = Collection(self.settings.collection)
+ indexed = collection.update_cache()
+ print("Found and indexed {} entries".format(indexed))
diff --git a/scripts/lesana b/scripts/lesana
index 0cc8a0e..3886f52 100755
--- a/scripts/lesana
+++ b/scripts/lesana
@@ -1,12 +1,13 @@
#!/usr/bin/env python3
import gadona
-from lesana.command import New
+from lesana.command import New, Index
if __name__ == '__main__':
app = gadona.App()
app.description = "Manage collections"
app.commands = [
New(),
+ Index(),
]
app.main()