Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/byebyebruce/clipty
Transform your Command Line Interface (CLI) function into a web browser-based terminal emulator.
https://github.com/byebyebruce/clipty
cli console golang gotty pty stdout tty tui web websocket
Last synced: 28 days ago
JSON representation
Transform your Command Line Interface (CLI) function into a web browser-based terminal emulator.
- Host: GitHub
- URL: https://github.com/byebyebruce/clipty
- Owner: byebyebruce
- License: mit
- Created: 2023-07-05T02:43:14.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-03-15T02:35:44.000Z (11 months ago)
- Last Synced: 2025-01-12T12:34:32.284Z (about 1 month ago)
- Topics: cli, console, golang, gotty, pty, stdout, tty, tui, web, websocket
- Language: Go
- Homepage:
- Size: 39.1 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CLIPTY
> Transform your Command Line Interface (CLI) function into a web browser-based terminal emulator.## Preview
![](doc/preview.png)## Usage
1.
```bash
go get github.com/byebyebruce/clipty
```
2.
```gofunc main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()opt := &server.Options{}
err := clipty.RunServerWithOption(ctx, opt, nil, func(ctx context.Context, params map[string][]string, stdin *os.File, stdout *os.File, stderr *os.File) {
for i := 0; i < 10; i++ {
select {
case <-ctx.Done():
return
default:
}
time.Sleep(time.Second)
fmt.Fprintln(stdout, "sleep", i+1)
}
fmt.Fprintln(stdout, "Bye..")
})
if err != nil {
log.Fatal(err)
}
}
```
3.
```bash
go run .
```
4. open http://localhost:8080
## Example
[example](example)## SPECIAL THANKS
* [pty](https://github.com/creack/pty)
* [GoTTY](https://github.com/sorenisanerd/gotty)![](https://hits.sh/github.com/byebyebruce/clipty/doc/hits.svg?label=%F0%9F%91%80)