diff options
author | Camil Staps | 2015-10-14 22:36:05 +0200 |
---|---|---|
committer | Camil Staps | 2015-10-14 23:02:03 +0200 |
commit | b3caf3f307b4c3f8dcc01258f8ba6f00a3ee5a5a (patch) | |
tree | 05575c980e929e720367d5993aef0c1d5eb8233f /cli.py | |
parent | Using Orator migrations (diff) |
Diffstat (limited to 'cli.py')
-rwxr-xr-x | cli.py | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -30,6 +30,39 @@ def init(): setup_fill_alternative_book_names(db) click.echo('Done.') +@cli.command() +@click.option('--nl/--no-nl', default=False, + help='Output every verse on a new line (default: false)') +@click.option('--vn/--no-vn', default=True, + help='Output verse and chapter numbers (default: true)') +@click.option('-t', '--translation', metavar='name', + help='Use a specific translation (default: config.py)') +@click.argument('reference', metavar='reference') +def read(nl, vn, translation, reference): + """Read a part of the Bible + + Examples: + + \b + cli.py read 'Genesis 1:1' + cli.py read 'Genesis 1:1' -t 'King James Bible' + cli.py read 'Gen 1:1-3' --no-vn + cli.py read 'Is 52:13-53:12' --nl + """ + passage = Passage.parse(reference) + chap = 0 + for v in passage.verses(): + if vn: + if chap != v.chapter: + chap = v.chapter + click.secho(str(chap) + ':', fg='yellow', nl=False) + click.secho(str(v.nr) + ' ', fg='cyan', nl=False) + + click.echo(str(v.get_translated(translation)) + ' ', nl=nl) + + if not nl: + click.echo() + def load_biblehub_line(columns, line): """Split a line from a Bible Hub dump into a usable dictionary @@ -105,5 +138,6 @@ def load(type, filename): click.secho('I don\'t know a type ' + type, fg='red') if __name__ == '__main__': + db = setup_database() cli() |