CMDConsoleManager - Macro206/CMDKit-Framework GitHub Wiki

CMDConsoleManager makes creating and managing a console very simple. It notifies its delegate of any input received.

Properties

NSString *consolePrefix
Displayed before every user input prompt.

id<CMDConsoleDelegate> delegate
The delegate is notified of any input received via the delegate method.

unsigned maxBufferSize
The maximum length of the user input. Defaults to 100 characters (1 byte each).

Class Methods

+ (id)consoleManagerWithPrefix:(NSString *)prefix andMaxBufferSize:(int)bufferSize
Creates a console manager with the given prefix and maximum length of user input (max number of characters).
bufferSize is in bytes. A char is 1 byte.

Instance Methods

- (void)startConsole
Starts the console. The prompt is shown, the input is passed to the delegate, and the prompt is displayed again. This process is repeated until stopConsole is called or the program is stopped.

- (void)stopConsole
Stops the console and allows the program to resume normally (from the point at which startConsole was called).
Note: This method should be called from console: didReceiveInput: (the delegate method) otherwise the console may not behave as expected.

⚠️ **GitHub.com Fallback** ⚠️