cli

Creates dynamic CLI’s for all apps

jobbergate.cli.app_factory()

This is the workhorse of cli module.

Click needs to have the code as a callback so we need to create the _callback function, which in turn returns a wrapper for each application. The app factory loops throug all the applications in the configed directory, and creates callbacks for each of them. This is the real workhorse in cli.

jobbergate.cli.ask_questions(fields, answerfile, use_defaults=False)

Asks the questions from all the fields.

Parameters:
  • fields (list[jobbergate.appform.QuestionBase]) – List with questions
  • answerfile (dict) – dict with prepopulated answers
  • use_defaults (bool) – option to use default value instead of asking, when possible
Returns:

all answers

Return type:

dict

jobbergate.cli.flatten(deeplist)

Helper function to flatten lists and tuples.

Parameters:deeplist (list) – list of varying dept
Returns:flattened list
Return type:list
jobbergate.cli.parse_field(field, ignore=None)

Parses the question field and returns a list of inquirer questions.

Parameters:
Returns:

inquirer question

Return type:

inquirer.Question

jobbergate.cli.parse_prefill(arguments)

Parses -p/--prefill command line arguments.

Parameters:arguments (list[string]) – all arguments given to -p/–prefill
Returns:dict with all command line answers
Return type:dict