Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/toniogela/catty
where cats and effects meet ttys
https://github.com/toniogela/catty
Last synced: 18 days ago
JSON representation
where cats and effects meet ttys
- Host: GitHub
- URL: https://github.com/toniogela/catty
- Owner: TonioGela
- Created: 2023-11-13T14:43:51.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-22T02:12:28.000Z (about 1 year ago)
- Last Synced: 2024-11-30T20:46:37.355Z (22 days ago)
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Catty
Let's collect resources as a first thing:
- [Scurses](https://github.com/Tenchi2xh/Scurses) and [jline3](https://github.com/jline/jline3) are good places where to find informations
- [Ansi Escape Code](https://en.wikipedia.org/wiki/ANSI_escape_code) from wikipedia.
- Eugene wrote an interesting post about console games/escape codes: http://eed3si9n.com/console-games-in-scala
- We'll need to investigate about what a tty exactly is, if there are terminal emulators that are not ttys, which and
where escape codes are supported, etc...
- It seems like we have two basic problems. Using ansi escape sequences, which should work out of the box for all
platforms, and setting the terminal mode, which will vary a lot depending on the platform.## Terminal IO Interfaces
Interacting with terminal I/O interfaces will be the part of the project that will need code for different operating
systems.### Posix (Linux, OSX, etc.)
On _Posix_ systems, terminal input can be interacted with via the C library
[termios.h](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/termios.h.html). There is already bindings for
this library in [Scala Native](https://github.com/scala-native/scala-native/blob/main/posixlib/src/main/scala/scala/scalanative/posix/termios.scala).
Here is a code sample from Java interacting with _termios.h_ on the [JVM through JNA](https://www.source-code.biz/snippets/java/RawConsoleInput/RawConsoleInput.java).### Windows
It appears that the library needed to interop with windows terminals is _msvcrt.dll_, based on the previously mentioned
[Java snippet](https://www.source-code.biz/snippets/java/RawConsoleInput/RawConsoleInput.java) that works from the JVM.We might also be able to use this:
[Windows Console Documentation](https://learn.microsoft.com/en-us/windows/console/classic-vs-vt)
[Inside the windows console](https://devblogs.microsoft.com/commandline/windows-command-line-inside-the-windows-console/)There are some APIs in [Scala Native](https://github.com/scala-native/scala-native/blob/main/windowslib/src/main/resources/scala-native/windows/console.c), they seem incomplete:
### JavaScript
For _Scala.js_ interop, there is a node library for interacting with a console: https://nodejs.org/api/tty.html