All Projects → Netflix → Go Expect

Netflix / Go Expect

Licence: apache-2.0
an expect-like golang library to automate control of terminal or console based programs.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Go Expect

Cli
Get a programmable email address. Automate what happens when you receive emails. It's like Zapier for devs who hate emails.
Stars: ✭ 105 (-55.51%)
Mutual labels:  automation, cli
Arkade
Open Source Kubernetes Marketplace
Stars: ✭ 2,343 (+892.8%)
Mutual labels:  automation, cli
Autobahn
CLI tool written in Swift heavily inspired by https://github.com/fastlane/fastlane
Stars: ✭ 116 (-50.85%)
Mutual labels:  automation, cli
Nps
NPM Package Scripts -- All the benefits of npm scripts without the cost of a bloated package.json and limits of json
Stars: ✭ 1,285 (+444.49%)
Mutual labels:  automation, cli
Procsd
Manage your application processes in production hassle-free like Heroku CLI with Procfile and Systemd
Stars: ✭ 181 (-23.31%)
Mutual labels:  automation, cli
Awesome React Generator
No more clicking around to create files in your react project! Awesome React Generator is Command Line Tool that let's you scaffold your components without leaving your terminal.
Stars: ✭ 98 (-58.47%)
Mutual labels:  automation, cli
Fjpublish
A simple CLI for publish your projects.
Stars: ✭ 126 (-46.61%)
Mutual labels:  automation, cli
Spam Bot 3000
Social media research and promotion, semi-autonomous CLI bot
Stars: ✭ 79 (-66.53%)
Mutual labels:  automation, cli
Licenseplist
A license list generator of all your dependencies for iOS applications
Stars: ✭ 1,996 (+745.76%)
Mutual labels:  automation, cli
Backport
A simple CLI tool that automates the process of backporting commits on a GitHub repo
Stars: ✭ 154 (-34.75%)
Mutual labels:  automation, cli
Nzb Subliminal
Fetches subtitles for the videos it's provided. It can be easily integrated into NZBGet and SABnzbd too.
Stars: ✭ 85 (-63.98%)
Mutual labels:  automation, cli
Mbt
The most flexible build tool for monorepo
Stars: ✭ 184 (-22.03%)
Mutual labels:  automation, cli
Dog
Dog wants to be a very good task runner
Stars: ✭ 84 (-64.41%)
Mutual labels:  automation, cli
Appicon
AppIcon generates *.appiconset contains each resolution image for iOS
Stars: ✭ 1,454 (+516.1%)
Mutual labels:  automation, cli
Ritchie Formulas
This repository contains the community formulas that can be executed through Ritchie CLI once imported. This tool is an open source product that allows you to create, store and share any kind of automations, executing them through command lines, to run operations or start workflows ⚙️ 🖥 💡
Stars: ✭ 84 (-64.41%)
Mutual labels:  automation, cli
Pipedream
Connect APIs, remarkably fast. Free for developers.
Stars: ✭ 2,068 (+776.27%)
Mutual labels:  automation, cli
Php codesniffer
PHP_CodeSniffer is a set of two PHP scripts; the main phpcs script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard, and a second phpcbf script to automatically correct coding standard violations. PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.
Stars: ✭ 9,004 (+3715.25%)
Mutual labels:  automation, cli
Sparrow
Sparrow - script distribution platform for Linux OS
Stars: ✭ 77 (-67.37%)
Mutual labels:  automation, cli
Brotab
Control your browser's tabs from the command line
Stars: ✭ 137 (-41.95%)
Mutual labels:  automation, cli
Tox
Command line driven CI frontend and development task automation tool.
Stars: ✭ 2,523 (+969.07%)
Mutual labels:  automation, cli

go-expect

Go codecov Build Status GoDoc NetflixOSS Lifecycle

Package expect provides an expect-like interface to automate control of applications. It is unlike expect in that it does not spawn or manage process lifecycle. This package only focuses on expecting output and sending input through it's pseudoterminal.

Usage

os.Exec example

package main

import (
	"log"
	"os"
	"os/exec"
	"time"

	expect "github.com/Netflix/go-expect"
)

func main() {
	c, err := expect.NewConsole(expect.WithStdout(os.Stdout))
	if err != nil {
		log.Fatal(err)
	}
	defer c.Close()

	cmd := exec.Command("vi")
	cmd.Stdin = c.Tty()
	cmd.Stdout = c.Tty()
	cmd.Stderr = c.Tty()

	go func() {
		c.ExpectEOF()
	}()

	err = cmd.Start()
	if err != nil {
		log.Fatal(err)
	}

	time.Sleep(time.Second)
	c.Send("iHello world\x1b")
	time.Sleep(time.Second)
	c.Send("dd")
	time.Sleep(time.Second)
	c.SendLine(":q!")

	err = cmd.Wait()
	if err != nil {
		log.Fatal(err)
	}
}

golang.org/x/crypto/ssh/terminal example

package main

import (
	"fmt"

	"golang.org/x/crypto/ssh/terminal"

	expect "github.com/Netflix/go-expect"
)

func getPassword(fd int) string {
	bytePassword, _ := terminal.ReadPassword(fd)

	return string(bytePassword)
}

func main() {
	c, _ := expect.NewConsole()

	defer c.Close()

	donec := make(chan struct{})
	go func() {
		defer close(donec)
		c.SendLine("hunter2")
	}()

	echoText := getPassword(int(c.Tty().Fd()))

	<-donec

	fmt.Printf("\nPassword from stdin: %s", echoText)
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].