You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 6, 2026. It is now read-only.
I've finally decided that Teco will be a macOS-specific framework that will support both line-oriented and screen-oriented apps, but only a limited set of terminal events, on its own way.
This issue tracks the addition of the final features I plan to add to the framework, which were previously being discussed in #17, #15, and #4.
Furthermore, I am already rewriting the documentation to be fully integrated within Xcode (#21).
Those features are:
// Cursor Manipulation Functions
// Moves the cursor to a specific coordinate.
try!Terminal.moveCursor(to:.init(column:0, row:0))try!Terminal.moveCursor(column:0, row:0)
// Moves the cursor in a direction by a given number of steps.
try!Terminal.moveCursor(.right, by:5)
// Obtains the current cursor coordinate.
letcursorCoordinate=try!Terminal.cursorCoordinate
Terminal.print("Cursor Coordinate: (column: \(cursorCoordinate.column), row: \(cursorCoordinate.row))")
// ---
// Signal Handling Function
// Sets the given signal handler, possibly injecting code to reset active terminal properties.
Terminal.attachSignalHandler(for:.sigint){Terminal.print("Interrupt Signal")}
// ---
// Event Reading Functions (only for screen resize and key events)
// Clear cached events from the input buffer.
Terminal.clearEventQueue()
// Pulls the next cached key event.
// Screen resize events are errors that need to be catched, so you don't need to unwrap an enum to filter keys.
Terminal.print("Press \("[Escape]".red.bold) to cancel...")do{letkey=tryTerminal.pullKeyEvent(waitFor:.seconds(2)){ $0 ==.escape }guard key ==nilelse{Terminal.print("Operation Cancelled".red, via:.error)}}catchTerminal.Error.screenResizeInterrupt {Terminal.print("Screen has been resized. Redrawing interface...")}catchTerminal.Error.timerElapsed {Terminal.print("Timer has been elapsed. Continuing operation.")}
// ---
// Convenient Input Functions
// Default values are optionals.
// Reads a line of input, similar to Swift's readLine function.
// Outputs: What is the name of your project? (default: My Project)
_ =try!Terminal.readLineQuestion("What is the name of your project?", default:"My Project")
// Reads the "Y" or "N" key input.
// Outputs: Do you want to proceed with the installation? (Y/n)
_ =try!Terminal.readYesOrNoQuestion("Do you want to proceed with the installation?", default:true)
I've finally decided that Teco will be a macOS-specific framework that will support both line-oriented and screen-oriented apps, but only a limited set of terminal events, on its own way.
This issue tracks the addition of the final features I plan to add to the framework, which were previously being discussed in #17, #15, and #4.
Furthermore, I am already rewriting the documentation to be fully integrated within Xcode (#21).
Those features are: