Skip to content

Console Tasks¤

compas_invocations2.console ¤

Functions:¤

chdir ¤

chdir(dirname=None)

Context-manager syntax to change to a directory and return to the current one afterwards.

confirm ¤

confirm(question, assume_yes=True)

Ask user a yes/no question and return their response as a boolean.

question should be a simple, grammatically complete question such as "Do you wish to continue?", and will have a string similar to " [Y/n] " appended automatically. This function will not append a question mark for you. By default, when the user presses Enter without typing anything, "yes" is assumed. This can be changed by specifying assume_yes=False.

.. note::

If the user does not supply input that is (case-insensitively) equal to
"y", "yes", "n" or "no", they will be re-prompted until they do.

Parameters:

  • question (str) –

    The question part of the prompt.

  • assume_yes (bool, default: True ) –

    Whether to assume the affirmative answer by default. Defaults to True.

Returns: