Please note
This documentation is for the stable (0.9) version of Fabric. To view documentation for the in-development (1.0) version, please click here.
Utils¶
Internal subroutines for e.g. aborting execution with an error message, or performing indenting on multiline output.
- fabric.utils.abort(msg)¶
Abort execution, printing given message and exiting with error status. When not invoked as the fab command line tool, raise an exception instead.
- fabric.utils.indent(text, spaces=4, strip=False)¶
Returns text indented by the given number of spaces.
If text is not a string, it is assumed to be a list of lines and will be joined by \n prior to indenting.
When strip is True, a minimum amount of whitespace is removed from the left-hand side of the given string (so that relative indents are preserved, but otherwise things are left-stripped). This allows you to effectively “normalize” any previous indentation for some inputs.
- fabric.utils.warn(msg)¶
Print warning message, but do not abort execution.