facio.state

class facio.state.State[source]
error(message)

Print error that does not result in an exit (Red)

Parameters:message (str) – Message to print to user
gather(message)

Common message prompting for gathering input form the end user.

Parameters:message (str) – Message to print to user
get_context_variable(name)[source]

Return a specific context variable value.

Parameters:name (str) – Context variable name
Returns:str or None – None if name not found in var list
get_context_variables()[source]

Returns the current context variables at time of call.

Retutns:dict
get_hook_call(module_path)[source]

Returns a hook call result, else returns false if the module path is not in the hook call list.

Parameters:module_path (str) – The python dotted path to the module
Returns:Call result
get_project_name()[source]

Return the project name stored in the state.

Returns:str
get_project_root()[source]

Return the project root, which is the current working directory plus the project name.

Returns:str
get_working_directory()[source]

Use the sh library to return the current working directory using the unix command pwd.

Returns:str
out(message, color=<function blue at 0x7f9c287a5848>)

Print message information to user (Blue)

Parameters:message (str) – Message to print to user

** Optional Key Word Arguments **

Parameters:color – Clint color function to use
Type:function – default blue
save_hook_call(module_path, result)[source]

Saves a hook call to state

Parameters:
  • module_path (str) – The python dotted path to the module
  • result (Anything) – The result of the module run() function
Returns:

list – The call list or tuples

set_project_name(name)[source]

Set the project name to the state.

Parameters:name (str) – The project name from facio.config.CommandLineInterface
success(message)

Print a success message (Green)

Parameters:message (str) – Message to print to user
update_context_variables(dictionary)[source]

Update the context varaibles dict with new values.

** Usage: **

from facio.state import state
dictionary = {
    'bar': 'baz',
    'fib': 'fab',
}
state.update_context_variables(dictionary)
Parameters:dictionary (dict) – Dictionary of new key values
warning(message)

Print a warning message (Yellow)

Parameters:message (str) – Message to print to user

Related Topics

This Page