Package
ConsoleKit
💻 APIs for creating interactive CLI tools.
Overview
ConsoleKit provides utilities for interacting with a console in a Swift application. It provides:
Utilities for sending text (including styles and colors, when supported) to a terminal.
Utilities for reading input from a terminal.
Topics
Terminal
protocol ConsoleProtocol for powering styled Console I/O.class TerminalGeneric console that uses a mixture of Swift and C standard libraries to fulfill protocol requirements.enum ConsoleColorSupported colors for creating aConsoleStyleforConsoleText.struct ConsoleStyleRepresentation of a style for outputting to a Console in different colors with differing attributes. A few suggested default styles are provided.enum ConsoleClearSupported methods for clearing theConsole.struct ConsoleTextA collection ofConsoleTextFragments. Represents stylized text that can be outputted to aConsole.struct ConsoleTextFragmentfunc + (ConsoleText, ConsoleText) -> ConsoleTextAppends aConsoleTextto anotherConsoleText.func += (inout ConsoleText, ConsoleText)Appends aConsoleTextto anotherConsoleTextin-place.extension StringProtocol
Activity
class ActivityIndicatorAn instance of aActivityIndicatorTypethat can be started, failed, and succeeded.protocol ActivityIndicatorTypeActivityIndicatorTypes are responsible for drawing / rendering the currentActivityIndicatorStateto theConsole.enum ActivityIndicatorStatePossible states to draw / render andActivityIndicatorType.protocol ActivityBarAnActivityIndicatorTypethat renders an activity bar on a single line.struct LoadingBarLoading-style implementation ofActivityBar.struct ProgressBarProgress-style implementation ofActivityBar.struct CustomActivityAn activity indicator with customizable frames and success and failure messages.
Structures
struct AnySendableHashableASendableversion of the standard library’sAnyHashabletype.