https://github.com/tiptenbrink/sancty
Sancty is an extension to jquast/blessed for simple editor-like terminal apps
https://github.com/tiptenbrink/sancty
blessed cli python terminal
Last synced: 5 months ago
JSON representation
Sancty is an extension to jquast/blessed for simple editor-like terminal apps
- Host: GitHub
- URL: https://github.com/tiptenbrink/sancty
- Owner: tiptenbrink
- License: apache-2.0
- Created: 2021-11-16T16:08:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-17T16:09:38.000Z (over 4 years ago)
- Last Synced: 2025-03-31T09:14:15.705Z (about 1 year ago)
- Topics: blessed, cli, python, terminal
- Language: Python
- Homepage:
- Size: 50.8 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sancty
Sancty is an extension to jquast/blessed for simple editor-like terminal apps
### Usage
Sancty has two major components, `Reader` (which follows the `ReaderProtocol`) and `Renderer` (which follows the `RendererProtocol`). As you are free to choose your own communication channel and event loop/threading architecture, these do not work out of the box. For implementations that work out of the box, take a look at `ProcessReader` and `ProcessRenderer`, which use standard `multiprocessing` classes to each run on their own thread. You can also spin up a basic editor by running `start_terminal()`.
If you don't want to customize the run architecture, but _do_ want to customize the `Reader` and `Renderer` classes, simply extend them (but be sure to still conform to their respective protocols) and pass the classes as variables to `start_terminal()`.
You can also pass a custom `replace_dict`, which is a dictionary of all possible `\\` commands. By default, the key swill correspond to strings that will be replaced by the value strings, but if the key is an integer, a custom `special_slash_fn` can also be passed to perform arbitrary transformations of the render array. Note that all negative numbers are reserved for this program.
#### Default `\\` commands
```python
default_replace_dict = {
"clr": (-1, "Clears all text"),
"help": (-2, "Shows all slash commands"),
}
```