mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 19:58:03 +01:00
Make 'cat' subcommand be capable to actually concatenate multiple recordings
This commit is contained in:
@@ -222,10 +222,10 @@ For help on a specific command run:
|
||||
|
||||
# create the parser for the `cat` command
|
||||
parser_cat = subparsers.add_parser(
|
||||
"cat", help="Print full output of terminal session"
|
||||
"cat", help="Print full output of terminal sessions"
|
||||
)
|
||||
parser_cat.add_argument(
|
||||
"filename", help='local path, http/ipfs URL or "-" (read from stdin)'
|
||||
"filename", nargs="+", help='local path, http/ipfs URL or "-" (read from stdin)'
|
||||
)
|
||||
parser_cat.set_defaults(cmd=CatCommand)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from .command import Command
|
||||
class CatCommand(Command):
|
||||
def __init__(self, args: Any, config: Config, env: Dict[str, str]):
|
||||
Command.__init__(self, args, config, env)
|
||||
self.filename = args.filename
|
||||
self.filenames = args.filename
|
||||
|
||||
def execute(self) -> int:
|
||||
try:
|
||||
@@ -22,10 +22,11 @@ class CatCommand(Command):
|
||||
|
||||
def cat(self) -> int:
|
||||
try:
|
||||
with asciicast.open_from_url(self.filename) as a:
|
||||
for _, _type, text in a.events("o"):
|
||||
sys.stdout.write(text)
|
||||
sys.stdout.flush()
|
||||
for filename in self.filenames:
|
||||
with asciicast.open_from_url(filename) as a:
|
||||
for _, _type, text in a.events("o"):
|
||||
sys.stdout.write(text)
|
||||
sys.stdout.flush()
|
||||
|
||||
except asciicast.LoadError as e:
|
||||
self.print_error(f"printing failed: {str(e)}")
|
||||
|
||||
Reference in New Issue
Block a user