PromptHandler

public protocol PromptHandler

A type that can handle print and read functions from command line prompt.

  • Print a string to standart output (stdout).

    Note

    Newline character is not printed automatically.

    Declaration

    Swift

    func print(_ string: String)

    Parameters

    string

    The string to be printed to standard output.

  • Print an error string to error output (stderr).

    Note

    Newline character is not printed automatically.

    Declaration

    Swift

    func print(error string: String)

    Parameters

    string

    The error string to be printed to error output.

  • Read line from standard input (stdin). Returned string must have stripped termination newline. If input cannot be read then must returns empty string.

    Declaration

    Swift

    func read() -> String

    Return Value

    String from input