A collection of classes and commands for automated command line scripting using Python.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

2.4 KiB

Python Script Tease

Overview

Script Tease is a library and command line tool for generating Bash commands programmatically and (especially) using configuration files.

The primary focus (and limit) is to convert plain text instructions (in INI or YAML format) into valid command line statements for a given platform. It does not provide support for executing those statements.

!!! warning YAML support is currently untested.

Concepts

Command Generation

Script Tease may be used in three (3) ways:

  1. Using the library to programmatically define commands and export them as command line statements.
  2. Using the tease command to generate commands from a configuration file. See steps file.
  3. Using the command file format and library to create a custom implementation.

This documentation focuses on the second method, but the developer docs may be used to guide custom implementations for 1 and 3 above.

Self-Documenting

The format of INI and YAML files is self-documenting. The command comment is this section (INI) or start of a list item (YAML). This ensures that all commands have a basic description of their purpose or intent.

[install apache]
install: apache2

- install apache
  install: apache2

Representing Commands

All commands are represented by simple, Python functions. These functions are responsible for accepting the arguments provided (usually by a command loader) and converting them into a common Command instance. This instance is then capable of generating a finished statement that may be used on the command line.

Profiles

Profiles contain command functions that are specific to an operating system. Not all operating systems support the same commands.

!!! note At present, the only defined operating system profiles are for Cent OS and Ubuntu.

Profiles import and appropriate all other available commands.

Terms and Definitions

command
When used in Script Tease documentation, this is a command instance which contains the properties and parameters for assembling a command line statement.
profile
A collection of commands that work for a specific operating system profile.
statement
A specific statement (string) to be executed. A statement is generated from a command.

License

Python Script Tease is released under the BSD 3 clause license.