summaryrefslogtreecommitdiff
path: root/lesana/command.py
blob: e900aad01e9058e57341d473192b17e56f685382 (plain)
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
import gadona
from . import Collection, Entry


class New(gadona.Command):
    name = 'new'
    arguments = [
        (['--collection', '-c'], dict(
            help='The collection to work on (default .)'
            )),
        ]

    def main(self):
        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))