Add a simple cat (path handling still needed)
This commit is contained in:
parent
ffefe4dd21
commit
01e9780bb8
1 changed files with 22 additions and 0 deletions
22
trovedb/cli/cat.py
Normal file
22
trovedb/cli/cat.py
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
"""Note List"""
|
||||||
|
import argparse
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from trovedb.cli import CliEnv
|
||||||
|
|
||||||
|
def setup(parser: argparse.ArgumentParser) -> None:
|
||||||
|
"""Configure this subcommand's arguments."""
|
||||||
|
parser.add_argument('-u', '--unbuffered', action='store_true',
|
||||||
|
help="Output raw bytes, without any decoding.")
|
||||||
|
parser.add_argument('notes', nargs='+', metavar='FILENAME',
|
||||||
|
help="One or more notes to process.")
|
||||||
|
|
||||||
|
|
||||||
|
def run(env: CliEnv, args: argparse.Namespace) -> None:
|
||||||
|
"""Entry point when this subcommand is invoked."""
|
||||||
|
|
||||||
|
# TODO: Resolve path!
|
||||||
|
for note in args.notes:
|
||||||
|
sys.stdout.buffer.write(env.local_trove.get_root().child(note).read_content())
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue