Skip to content

Transform your Command Line Interface (CLI) function into a web browser-based terminal emulator.

License

Notifications You must be signed in to change notification settings

byebyebruce/clipty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLIPTY

Transform your Command Line Interface (CLI) function into a web browser-based terminal emulator.

Preview

Usage

  1. go get github.com/byebyebruce/clipty
  2. func 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. go run .
  4. open http://localhost:8080

Example

example

SPECIAL THANKS

About

Transform your Command Line Interface (CLI) function into a web browser-based terminal emulator.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published