skaff package¶
Submodules¶
skaff.cli module¶
Main command line driver program for skaff.
-
class
skaff.cli.SmartFormatter(*args, **kw)[source]¶ Bases:
argparse.HelpFormatterYou 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.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'¶
-
-
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.config module¶
Custom configuration type for the ‘core’ skaff module.
-
class
skaff.config.SkaffConfig(directories, **kwargs)[source]¶ Bases:
objectConfiguration type used for the argument of ‘skaff’ function.
Adds ‘author’ to the internal ‘database’ if the name does not exist; otherwise do nothing.
Discards ‘author’ from the internal ‘database’ if the name exists; otherwise do nothing.
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.
Gets the author(s) of the project(s).
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_set(directories=None)[source]¶ Sets the name(s) of the outputting project-directory(ies). ‘directories’ must be an iterable type containing ‘str’(s). 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.
-
directory_discard(directory)[source]¶ Discards ‘directory’ from the internal ‘database’ if the name exists; otherwise do nothing.
-
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’.
-
languages_list()[source]¶ Lists the supported primary programming languages. By default they are the following: {“c”, “cpp”}.
-
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’.
-
licenses_list()[source]¶ Lists the supported licenses. By default they are the following: {“bsd2”, “bsd3”, “gpl2”, “gpl3”, “mit”}.
-
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 the name(s) of the subdirectory(ies) within the project(s)’ base directory(ies).
-
subdirectories_set(subdirectories)[source]¶ Sets the name(s) of the subdirectory(ies) within the project(s)’ base directory(ies). This member function is called by the constructor by default.
‘subdirectories’ argument must be of ‘collections.Iterable’ type containing instance of ‘str’(s).
skaff.core module¶
Main module of skaff.
-
skaff.core.skaff(author, directories, language, license, quiet)[source]¶ Creates all the necessary subdirectories in addition to the project root.
All arguments can be ‘None’ except ‘directories’, which must be a list of strings of length >= 1.
If the above is the case, ‘author’ will be guessed by GECOS field and login name of the current user; ‘language’ will default to ‘c’, ‘license’ will be set to ‘bsd2’, ‘quiet’ will be unchanged (equivalent to False).