Skip to main content

The cliplayer helps to script shell based lectures and screencast tutorials

Project description

cliplayer

cliplayer helps to script shell based lectures or screencast trainings. The player takes a playbook with shell commands that are executed live like you write them at this moment.

Motivation

When holding lectures or recording screencast you often need to devide your attention between talking and typing at the same time. This cliplayer helps you to concentrate more on what you want to teach instead of what you need to type.

Installation

pip install cliplayer

Usage

cliplayer [-h] [-p PROMPT] [-n NEXT_KEY] [-i INTERACTIVE_KEY] 
               [-b BASE_SPEED] [-m MAX_SPEED]
               [playbook]

-h
   Show the cli help

-p PROMPT
   Change the PS1 prompt of the player

-n NEXT_KEY
   key to press to execute the next command. Default: Enter

-i INTERACTIVE_KEY
   key to press for a interactive bash as the next command. Default: End

-b BASE_SPEED
   Set the base speed of typing one character. Default: 0.03

-m MAX_SPEED
   Set the max speed of typing one character. Default: 0.15

--detect-keys
   Detect and display key escape sequences for your system

playbook
   Path and name of the playbook to execute

Config files

After the first usage, there is a configuration file in the home directory to manipulate the default settings.

$ cat ~/.config/cliplayer/cliplayer.cfg
[DEFAULT]
prompt = \033[91mCLIplayer Training \033[92m$\033[0m
playbook_name = ./playbook
next_key = ENTER
interactive_key = END
base_speed = 0.03
max_speed = 0.15

There is also the file key_mappings.cfg to map the key escape sequences of your system to the key names that are used in the cliplayer.cfg. Use cliplayer --detect-keys if your system uses other key escape sequences.

Playbook Options

There are a few playbook options that control how and if a line in a playbook is executed. Use the defined characters as the first character in a line to use the available options.

  1. "!"

    Comment in the playbook. The content of this line will not be shown or executed.

    Example:

     ! This is a comment with some important information
    
  2. " "

    If no special character is used as the first character, the command is printed and executed as a normal non interactive shell command.

    Examples:

     echo "Hello World" > Readme.txt
     cat Readme.txt
    
  3. "*"

    Create a directory and execute the following playbook commands in this directory. These directories can be removed at the end of the training or stopping the playbook with Ctrl-C.

    Examples:

     * ../../awesome_training
     * /tmp/awesome_training
    
  4. "_"

    Execute a command and get interactive control over it. This is used since you don't want or can't automate every command.

    Examples:

    _vim Readme.txt
    _man bash
    
  5. "="

    A two part command. The first part is executed but not shown. The output of the first part, replace a variable in the second non interactive command part. The two command parts are seperated by three dollar signs "$$$". The variable that changed is named VAR.

    Example:

     = date | cut -c12-20 $$$ # The time is VAR
    
  6. "$"

    Same as the = option with the difference that you get interactive control over the second command.

    Example:

     $ date +%B $$$ vim Corona_Diary_VAR
    
  7. "+"

    Get an interactive bash prompt to execute commands that you don't want to automate. To exit an interactive session, press Ctrl - ]

    Examples:

     +
     + You can write everything you want behind a +. It will not be shown or executed.
    

Special keys

  1. "Enter"

    To execute the next command of the playbook, press the "Enter" key.

  2. "End"

    To get an interactive bash, press the "End" key after a playbook command.

  3. "Ctrl-]"

    To exit an interactive bash sequence, press "Ctrl-]".

  4. "Ctrl-C"

    To exit the cliplayer before the playbook is finished, press "Ctrl-C".

Hint

The keys are chosen because most notebooks have them. If your you don't like the default keys, reconfigure the player with the configuration file or while starting cliplayer.

Build and install from source

$ clone https://github.com/howto-kubernetes-info/cliplayer.git
$ cd cliplayer
$ python3 setup.py sdist bdist_wheel
$ pip install --force-reinstall dist/cliplayer-0.1.4.tar.gz  # Change the version number to the right version

Video training

CLIplayer training video

Links

How to create a prompt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cliplayer-0.1.4.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

cliplayer-0.1.4-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file cliplayer-0.1.4.tar.gz.

File metadata

  • Download URL: cliplayer-0.1.4.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for cliplayer-0.1.4.tar.gz
Algorithm Hash digest
SHA256 cc62de6c22905a48ccddf919e8814da39118673a63718ede980e9de7605aef6e
MD5 20c8e5b0415ce35007e088146ed485c2
BLAKE2b-256 fb914187172e4340f706cdf2a0ef01fb5388109a6743547028678c9789a9f5d7

See more details on using hashes here.

File details

Details for the file cliplayer-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: cliplayer-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for cliplayer-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5889c2f5d3481828ee45f07ed4452140c4796d6806c62de7d79105aa7b2a9e7f
MD5 b2a434eca7ae183c031a139bb7817585
BLAKE2b-256 2fcc5cd729dd2e2f292e855e5286f5ade1ef52e1dde7f889599cfa64b84c5460

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page