Command Line Program Documentation

purdy Command

Purdy is a library and set of command line tools for displaying code. You can use the library to write your display animations, or use this program as a code viewer.

usage: purdy [-h]
             [-l {py,repl,con,css,dbash,html,json,md,node,plain,rst,rs,toml,tuicon,yaml,htm,tcon,tcss,txt,yml}]
             [--version] [--num NUM] [--wrap WRAP] [--nocolour]
             [--highlight HIGHLIGHT]
             [--theme {default,no_colour,no_color,rtf,pyrepl}]
             [--maxheight MAXHEIGHT] [--notyping]
             filename

Positional Arguments

filename

Name of file to parse

Named Arguments

-l, --lexer

Possible choices: py, repl, con, css, dbash, html, json, md, node, plain, rst, rs, toml, tuicon, yaml, htm, tcon, tcss, txt, yml

Name of lexer to use to parse the file. Defaults to automaticallly detecting based on name of file. Choices are:
  • ‘py’ – Python 3 Source

  • ‘repl’ – Interactive Python 3 console

  • ‘con’ – Interactive bash console

  • ‘css’ – CSS

  • ‘dbash’ – Interactive bash Console with a dollar-sign prompt

  • ‘html’ – HTML/Django/Jinja

  • ‘json’ – JSON

  • ‘md’ – Markdown Doc

  • ‘node’ – Interactive JavaScript Node.js Console

  • ‘plain’ – Plain text, no parsing

  • ‘rst’ – RST Doc

  • ‘rs’ – Rust Language

  • ‘toml’ – TOML

  • ‘tuicon’ – Bash Console with Textual highlighting

  • ‘yaml’ – YAML Doc

  • ‘htm’ – Alias for html

  • ‘tcon’ – Alias for tuicon

  • ‘tcss’ – Alias for css

  • ‘txt’ – Alias for plain

  • ‘yml’ – Alias for yaml

Default: 'detect'

--version

show program’s version number and exit

--num

Display line numbers with code starting with the value given here

--wrap

Wrap line width at this value

--nocolour, --nc

By default code is colourized. This flag turns that off.

Default: False

--highlight, --hl

Highlight a code segment. This argument can be used multipletimes. Each value can be a line number (zero-indexed, negative indexing supported, a range separated by a dash (‘1-3’ index 1, 2, and 3 highlighted), or highlight within the line (‘3:10,5’ for index 3, highlighting starting at character 10, for 5 characters

--theme

Possible choices: default, no_colour, no_color, rtf, pyrepl

Which colourization theme to use

Default: 'default'

--maxheight

Sets a maximum screen height for the TUI screen viewer.

--notyping

Turns off the typing animation

Default: False

subpurdy Command

Purdy is a library and set of command line tools for displaying code. You can use the library to write your display animations, or use the subcommands of this program for preset usages. The ‘purdy’ command uses the Textual library to display a colourized version of your code in the console, while ‘subpurdy’ command is a set of utilities for printing different styles of code to the screen.

usage: subpurdy [-h]
                [-l {py,repl,con,css,dbash,html,json,md,node,plain,rst,rs,toml,tuicon,yaml,htm,tcon,tcss,txt,yml}]
                [--version]
                {tokens,ansi,html,rtf} ... filename

Positional Arguments

filename

Name of file to parse

Named Arguments

-l, --lexer

Possible choices: py, repl, con, css, dbash, html, json, md, node, plain, rst, rs, toml, tuicon, yaml, htm, tcon, tcss, txt, yml

Name of lexer to use to parse the file. Defaults to automaticallly detecting based on name of file. Choices are:
  • ‘py’ – Python 3 Source

  • ‘repl’ – Interactive Python 3 console

  • ‘con’ – Interactive bash console

  • ‘css’ – CSS

  • ‘dbash’ – Interactive bash Console with a dollar-sign prompt

  • ‘html’ – HTML/Django/Jinja

  • ‘json’ – JSON

  • ‘md’ – Markdown Doc

  • ‘node’ – Interactive JavaScript Node.js Console

  • ‘plain’ – Plain text, no parsing

  • ‘rst’ – RST Doc

  • ‘rs’ – Rust Language

  • ‘toml’ – TOML

  • ‘tuicon’ – Bash Console with Textual highlighting

  • ‘yaml’ – YAML Doc

  • ‘htm’ – Alias for html

  • ‘tcon’ – Alias for tuicon

  • ‘tcss’ – Alias for css

  • ‘txt’ – Alias for plain

  • ‘yml’ – Alias for yaml

Default: 'detect'

--version

show program’s version number and exit

subcommands

command

Possible choices: tokens, ansi, html, rtf

Sub-commands

tokens

Prints out each line in a file with the corresponding tokens indented beneath it

subpurdy tokens [-h] [--nocolour]
Named Arguments
--nocolour, --nc

By default code is colourized. This flag turns that off.

Default: False

ansi

Prints code with colourized ANSI results in your terminal

subpurdy ansi [-h] [--num NUM] [--wrap WRAP] [--nocolour]
              [--highlight HIGHLIGHT] [--bg BG]
Named Arguments
--num

Display line numbers with code starting with the value given here

--wrap

Wrap line width at this value

--nocolour, --nc

By default code is colourized. This flag turns that off.

Default: False

--highlight, --hl

Highlight a code segment. This argument can be used multipletimes. Each value can be a line number (zero-indexed, negative indexing supported, a range separated by a dash (‘1-3’ index 1, 2, and 3 highlighted), or highlight within the line (‘3:10,5’ for index 3, highlighting starting at character 10, for 5 characters

--bg

Change the background colour. Indicated using hex RRGGBB format, like HTML #AABBCC, but without the leading #

html

Prints code as HTML

subpurdy html [-h] [--fullhtml] [--num NUM] [--wrap WRAP] [--nocolour]
              [--highlight HIGHLIGHT] [--bg BG]
Named Arguments
--fullhtml

By default only a div with the code is shown. This flag causes a full HTML doc.

Default: False

--num

Display line numbers with code starting with the value given here

--wrap

Wrap line width at this value

--nocolour, --nc

By default code is colourized. This flag turns that off.

Default: False

--highlight, --hl

Highlight a code segment. This argument can be used multipletimes. Each value can be a line number (zero-indexed, negative indexing supported, a range separated by a dash (‘1-3’ index 1, 2, and 3 highlighted), or highlight within the line (‘3:10,5’ for index 3, highlighting starting at character 10, for 5 characters

--bg

Change the background colour. Indicated using hex RRGGBB format, like HTML #AABBCC, but without the leading #

rtf

Prints code as RTF

subpurdy rtf [-h] [--num NUM] [--wrap WRAP] [--nocolour]
             [--highlight HIGHLIGHT] [--bg BG]
Named Arguments
--num

Display line numbers with code starting with the value given here

--wrap

Wrap line width at this value

--nocolour, --nc

By default code is colourized. This flag turns that off.

Default: False

--highlight, --hl

Highlight a code segment. This argument can be used multipletimes. Each value can be a line number (zero-indexed, negative indexing supported, a range separated by a dash (‘1-3’ index 1, 2, and 3 highlighted), or highlight within the line (‘3:10,5’ for index 3, highlighting starting at character 10, for 5 characters

--bg

Change the background colour. Indicated using hex RRGGBB format, like HTML #AABBCC, but without the leading #

ansi2tui Command

Reads ANSI colour sequences text from the clipboard and outputs Textual TUI markup

usage: ansi2tui [-h]

This utility converts text containing ANSI colour sequences (8-bit/256 colour or lower) to Textual TUI markup. It reads from the clipboard and outputs the equivalent markup to the screen. If you are running the macOS iTerm2 program, use ‘Copy With Control Sequences’ from the ‘Edit’ menu to copy highlighted text from the terminal in a compatible fashion.