{"id":20334833,"url":"https://github.com/integrii/interactive","last_synced_at":"2025-07-31T17:38:02.104Z","repository":{"id":57494928,"uuid":"104692973","full_name":"integrii/interactive","owner":"integrii","description":"🐚 Execute and interact with any command line program using Go channels.","archived":false,"fork":false,"pushed_at":"2018-05-11T03:51:07.000Z","size":15,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-14T20:46:48.018Z","etag":null,"topics":["command","command-line","go","interactive","shell","tty"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/integrii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-25T02:10:01.000Z","updated_at":"2024-07-24T19:33:17.000Z","dependencies_parsed_at":"2022-08-28T16:11:10.066Z","dependency_job_id":null,"html_url":"https://github.com/integrii/interactive","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integrii%2Finteractive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integrii%2Finteractive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integrii%2Finteractive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integrii%2Finteractive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/integrii","download_url":"https://codeload.github.com/integrii/interactive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233920878,"owners_count":18751142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command","command-line","go","interactive","shell","tty"],"created_at":"2024-11-14T20:38:18.984Z","updated_at":"2025-01-14T16:22:20.883Z","avatar_url":"https://github.com/integrii.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# interactive 🐚\nInteractive is a package for easily executing and interacting with CLI commands using channels.  Uses a PTY and simple channels for inputting lines of strings and reading lines of strings.  You can always go direct to the running process and write bytes, though, too.  A cool example of this in use is my [headlessChrome](https://github.com/integrii/headlessChrome) package which starts headless chrome with `--repl` (a command line javascript console interface) for very, very realistic website automation.\n\nAutomate any command line task with a go program!  Special thanks to [github.com/kr/pty](https://github.com/kr/pty)\n\n## Get It\n\n`go get -u github.com/integrii/interactive`\n\n## Read the Godoc\n\n[https://godoc.org/github.com/integrii/interactive](https://godoc.org/github.com/integrii/interactive)\n\n\n## Example\n\n```go\n\nfunc main() {\n  // Start the command \"bc\" (a CLI calculator)\n  bc, err := interactive.NewSession(\"bc\", []string{})\n  if err != nil {\n    panic(err)\n  }\n\n  // start a concurrent output reader from the output channel of our command\n  go outputPrinter(bc.Output)\n\n  // write 1 + 1 to the bc prompt\n  bc.Write(`1 + 1`)\n\n  // wait one second for the output to come and be displayed\n  time.Sleep(time.Second)\n\n}\n\nfunc outputPrinter(c chan string) {\n  for s := range c {\n    fmt.Println(s)\n  }\n}\n\n```\n\nThis will print to the console the following:\n\n```bash\nbc 1.06\nCopyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.\nThis is free software with ABSOLUTELY NO WARRANTY.\nFor details type `warranty'.\n1 + 1\n2\n```\n\nYou can run and control nearly anything you could from your console this way.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintegrii%2Finteractive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintegrii%2Finteractive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintegrii%2Finteractive/lists"}