skaff package

Submodules

skaff.cli module

Main command line driver program for skaff.

class skaff.cli.SmartFormatter(*args, **kw)[source]

Bases: argparse.HelpFormatter

You can only specify one formatter in standard argparse, so you cannot both have pre-formatted description (RawDescriptionHelpFormatter) and ArgumentDefaultsHelpFormatter. The SmartFormatter has sensible defaults (RawDescriptionFormatter) and the individual help text can be marked ( help=”R|” ) for variations in formatting. Version string is formatted using _split_lines and preserves any line breaks in the version string.

skaff.cli.main()[source]

Parses and validates command line option flags, then invoke ‘skaff()’.

skaff.clitools module

A suite of command line based tools.

class skaff.clitools.ANSIColor[source]

Bases: object

BLUE = '\x1b[34m'
BOLD = '\x1b[1m'
CYAN = '\x1b[36m'
GREEN = '\x1b[32m'
KHAKI = '\x1b[1;33m'
MAGENTA = '\x1b[35m'
PURPLE = '\x1b[1;35m'
RED = '\x1b[31m'
RESET = '\x1b[0m'
YELLOW = '\x1b[33m'
exception skaff.clitools.TimeOutError[source]

Bases: Exception

skaff.clitools.single_keypress_read()[source]

Waits for a single keypress on stdin.

This is a silly function to call if you need to do it a lot because it has to store stdin’s current setup, setup stdin for reading single keystrokes then read the single keystroke then revert stdin back after reading the keystroke.

Returns the character of the key that was pressed (zero on KeyboardInterrupt which can happen when a signal gets handled)

skaff.clitools.timeout(seconds, error_message='Timer expired')[source]

Sets a timer on a function; should be used as a decorator.

Raises ‘TimeOutError’ upon expiration.

skaff.config module

Custom configuration type definition used for the ‘core’ skaff module.

class skaff.config.SkaffConfig(directories, **kwargs)[source]

Bases: object

Configuration type used for the argument of ‘skaff’ function.

author_add(author)[source]

Adds ‘author’ to the internal ‘database’ if the name does not exist; otherwise do nothing.

author_discard(author)[source]

Discards ‘author’ from the internal ‘database’ if the name exists; otherwise do nothing.

static author_fetch()[source]

Gets the current logged-in username from GECOS or name field. This member function is called by the constructor by default.

Raises RuntimeError if both attempts fail.

Note this ‘classmethod’ may be automatically called from ‘authors_get’ member function under certain scenarios.

authors_get()[source]

Gets a generator containing author(s) for the project(s).

authors_set(authors=None)[source]

Sets the author(s) of the project(s). ‘authors’ must be an iterable type containing ‘str’(s). This member function is called by the constructor by default.

Sets the single author to be the GECOS or name field of current logged-in user if ‘authors’ is left as default or ‘None’.

directories_get()[source]

Gets a generator containing name(s) for the outputting project-directory(ies).

directories_set(directories=None)[source]

Sets the name(s) of the outputting project-directory(ies). Platform-dependent path separator will be appended if missing. This member function is called by the constructor by default.

‘directories’ argument must be of ‘collections.Iterable’ type containing instance of ‘str’(s).

directory_add(directory)[source]

Adds ‘directory’ to the internal ‘database’ if the name does not exist; otherwise do nothing. Platform-dependent path separator will be appended if missing.

directory_discard(directory)[source]

Discards ‘directory’ from the internal ‘database’ if the name exists; otherwise do nothing. Platform-dependent path separator will be appended if missing.

language_get()[source]

Gets the major programming language used.

language_set(language=None)[source]

Sets the major programming language used. Defaults to ‘c’ language if left as empty or ‘None’. This member function is called by the constructor by default.

‘language’ argument must be the ones listed in ‘languages_list’.

classmethod languages_list()[source]

Gets a generator containing the supported programming languages.

By default they are the following: {“c”, “cpp”}.

license_get()[source]

Gets the type of license.

license_set(license=None)[source]

Sets the type of license. Defaults to ‘bsd2’ license if left as empty or ‘None’. This member function is called by the constructor by default.

‘license’ argument must be the ones listed in ‘licenses_list’.

classmethod licenses_list()[source]

Gets a generator containing the supported licenses.

By default they are the following: {“bsd2”, “bsd3”, “gpl2”, “gpl3”, “mit”}.

quiet_get()[source]

Gets whether there is interactive CMakeLists.txt and Doxyfile editing.

quiet_set(quiet=None)[source]

Sets whether there is interactive CMakeLists.txt and Doxyfile editing. ‘True’ to turn off the interactive editing. Defaults to ‘False’ if left as empty or ‘None’. This member function is called by the constructor by default.

‘quiet’ argument must be of ‘bool’ type.

subdirectories_get()[source]

Gets a generator containing name(s) of the subdirectory(ies) within the project(s)’ base directory(ies).

subdirectories_set(subdirectories=None)[source]

Sets the name(s) of the subdirectory(ies) within the project(s)’ base directory(ies). Defaults to {“build”, “coccinelle”, “doc”, “examples”, “img”, “src”, “tests”} if left as empty or ‘None’. Platform-dependent path separator will be appended if missing. This member function is called by the constructor by default.

‘subdirectories’ argument must be of ‘collections.Iterable’ type containing instance of ‘str’(s).

subdirectory_add(subdirectory)[source]

Adds ‘subdirectory’ to the internal ‘database’ if the name does not exist; otherwise do nothing. Platform-dependent path separator will be appended if missing.

subdirectory_discard(subdirectory)[source]

Discards ‘subdirectory’ from the internal ‘database’ if the name exists; otherwise do nothing. Platform-dependent path separator will be appended if missing.

skaff.core module

Main module of skaff.

skaff.core.skaff(config)[source]

Creates all the necessary subdirectories in addition to the project root.

skaff.core.skaff_version_get()[source]

Returns the version information string of the skaff program.

Module contents