How to use the asciinema.commands.command.Command function in asciinema

To help you get started, we’ve selected a few asciinema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github timhsutw / honeyterm / honeyterm_asciinema / asciinema / asciinema / commands / upload.py View on Github external
def __init__(self, api, filename):
        Command.__init__(self)
        self.api = api
        self.filename = filename
github asciinema / asciinema / asciinema / commands / play.py View on Github external
def __init__(self, args, config, env, player=None):
        Command.__init__(self, args, config, env)
        self.filename = args.filename
        self.idle_time_limit = args.idle_time_limit
        self.speed = args.speed
        self.player = player if player is not None else Player()
github asciinema / asciinema / asciinema / commands / cat.py View on Github external
def __init__(self, args, config, env):
        Command.__init__(self, args, config, env)
        self.filename = args.filename
github timhsutw / honeyterm / honeyterm_asciinema / asciinema / asciinema / commands / play.py View on Github external
def __init__(self, filename, max_wait, speed, player=None):
        Command.__init__(self)
        self.filename = filename
        self.max_wait = max_wait
        self.speed = speed
        self.player = player if player is not None else Player()
github asciinema / asciinema / asciinema / commands / play.py View on Github external
from asciinema.commands.command import Command
from asciinema.player import Player
import asciinema.asciicast as asciicast


class PlayCommand(Command):

    def __init__(self, args, config, env, player=None):
        Command.__init__(self, args, config, env)
        self.filename = args.filename
        self.idle_time_limit = args.idle_time_limit
        self.speed = args.speed
        self.player = player if player is not None else Player()

    def execute(self):
        try:
            with asciicast.open_from_url(self.filename) as a:
                self.player.play(a, self.idle_time_limit, self.speed)

        except asciicast.LoadError as e:
            self.print_error("playback failed: %s" % str(e))
            return 1
github timhsutw / honeyterm / honeyterm_asciinema / asciinema / asciinema / commands / record.py View on Github external
import sys
import os
import tempfile

from asciinema.commands.command import Command
from asciinema.recorder import Recorder
from asciinema.api import APIError


class RecordCommand(Command):

    def __init__(self, api, filename, command, title, assume_yes, quiet, max_wait, recorder=None):
        Command.__init__(self, quiet)
        self.api = api
        self.filename = filename
        self.command = command
        self.title = title
        self.assume_yes = assume_yes or quiet
        self.max_wait = max_wait
        self.recorder = recorder if recorder is not None else Recorder()

    def execute(self):
        if self.filename == "":
            self.filename = _tmp_path()
            upload = True
        else:
github asciinema / asciinema / asciinema / commands / record.py View on Github external
import os
import sys
import tempfile

import asciinema.recorder as recorder
import asciinema.asciicast.raw as raw
import asciinema.asciicast.v2 as v2
from asciinema.api import APIError
from asciinema.commands.command import Command


class RecordCommand(Command):

    def __init__(self, args, config, env):
        Command.__init__(self, args, config, env)
        self.quiet = args.quiet
        self.filename = args.filename
        self.rec_stdin = args.stdin
        self.command = args.command
        self.env_whitelist = args.env
        self.title = args.title
        self.assume_yes = args.yes or args.quiet
        self.idle_time_limit = args.idle_time_limit
        self.append = args.append
        self.overwrite = args.overwrite
        self.raw = args.raw
        self.writer = raw.writer if args.raw else v2.writer
        self.env = env
github asciinema / asciinema / asciinema / commands / upload.py View on Github external
def __init__(self, args, config, env):
        Command.__init__(self, args, config, env)
        self.filename = args.filename
github asciinema / asciinema / asciinema / commands / cat.py View on Github external
import sys

from asciinema.commands.command import Command
import asciinema.asciicast as asciicast


class CatCommand(Command):

    def __init__(self, args, config, env):
        Command.__init__(self, args, config, env)
        self.filename = args.filename

    def execute(self):
        try:
            with asciicast.open_from_url(self.filename) as a:
                for t, _type, text in a.stdout_events():
                    sys.stdout.write(text)
                    sys.stdout.flush()

        except asciicast.LoadError as e:
            self.print_error("printing failed: %s" % str(e))
            return 1
github asciinema / asciinema / asciinema / commands / record.py View on Github external
def __init__(self, args, config, env):
        Command.__init__(self, args, config, env)
        self.quiet = args.quiet
        self.filename = args.filename
        self.rec_stdin = args.stdin
        self.command = args.command
        self.env_whitelist = args.env
        self.title = args.title
        self.assume_yes = args.yes or args.quiet
        self.idle_time_limit = args.idle_time_limit
        self.append = args.append
        self.overwrite = args.overwrite
        self.raw = args.raw
        self.writer = raw.writer if args.raw else v2.writer
        self.env = env