Clirunner - Package clirunner runs a legacy shell-style CLI as if a human were running it.

clirunner Go Report Card Go Reference

Package clirunner runs a legacy shell-style command-line interpreter (CLI) as if a human were running it.

A shell-style CLI offers a prompt and a set of commands (e.g. mysql). A human fires it up, issues a command, then reads the output. Armed with this new knowledge, the human issues a new command using some of this knowledge in the new command, etc.

The framework here runs the CLI as a subprocess, and arranges for piping of stderr and stdout to instances of Commander.

type Commander interface {
  // Stringer provides a command via String(), e.g. the command "echo".
  fmt.Stringer

  // Writer accepts CLI output for parsing.
  //
  // Output from the CLI subprocess' stdout and stderr should be sent
  // into Write.  Commander can accumulate whatever good data and
  // errors it desires.
  io.Writer
}

Your job as a framework user is implement Commander instances in Go, and write a main that feeds them into ProcRunner (see example_test.go).

The overall experience should be more enjoyable than trying to hack together something in bash.

Similar Resources

💾 A visual du(1) alternative for human beings

dux A disk usage analyzer. Like du(1), but displays the results as an interactive treemap. testdata 111B (8 files) (4) ┌testdata/ 111B────────────

Sep 6, 2022

GitHub CLI extension to preview your markdown similar to the style of GitHub.

GitHub CLI extension to preview your markdown similar to the style of GitHub.

gh markdown-preview GitHub CLI extension to preview your markdown similar to the style of GitHub gh markdown-preview is a GitHub CLI extension to prev

Jan 8, 2023

Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

Description pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. pflag is compatible with the GNU extensions to

Dec 30, 2022

Dinogo is an CLI framework for build terminal and shell applications in Go.

dinogo Dinogo is an CLI framework for build terminal and shell applications in Go. Features Cross Platform Fast and efficient Keyboard API Enable/Disa

Aug 29, 2022

Generate an interactive, autocompleting shell for any Cobra CLI

Generate an interactive, autocompleting shell for any Cobra CLI

cobra-shell Description Leverages the Cobra completion API to generate an interactive shell for any Cobra CLI, powered by go-prompt. On-the-fly autoco

Dec 19, 2022

A powerful modern CLI and SHELL

A powerful modern CLI and SHELL

Grumble - A powerful modern CLI and SHELL There are a handful of powerful go CLI libraries available (spf13/cobra, urfave/cli). However sometimes an i

Dec 30, 2021

A simple CLI based rock-paper-scissors game created in GO with interactive shell prompt.

rock-paper-scissors A simple CLI (Command Line Interface) based rock-paper-scissors game with interactive shell prompt. Language Download Grab a binar

Oct 9, 2022

being a gh extension that runs animated terminal "screensavers"

gh-screensaver being a gh extension that runs animated terminal "screensavers" usage gh screensaver run a random screensaver gh screensaver -s pipes r

Nov 29, 2022

Jsos - A operating system that runs system-level javascript, based on the Linux kernel

JsOS 🚀 An linux-based operating system that runs Javascript code at the system-

Jan 6, 2023
A simple go program which checks if your websites are running and runs forever (stop it with ctrl+c). It takes two optional arguments, comma separated string with urls and an interval.

uptime A simple go program which checks if your websites are running and runs forever (stop it with ctrl+c). It takes two optional arguments: -interva

Dec 15, 2022
Go package for running Linux distributed shell commands via SSH.
Go package for running Linux distributed shell commands via SSH.

Go package for running Linux distributed shell commands via SSH.

Dec 7, 2022
V2 because I wasn't happy with the way things were going in V1

Pokerchips V2 A client/server app that simulates poker chips so you and your friends can play poke without physical chips! Client The client is writte

Oct 2, 2022
CLI tool (hcron) and Go library (cron) to convert CRON expression into human readable description.

cron cron is a Go library that parses a cron expression and outputs a human readable description of the cron schedule. For example, given the expressi

Nov 12, 2022
ap 是一个 shell 工具,可以让其它 shell 命令的输出能够自动进入交互翻页模式

ap -- auto-pager ap 是一个 shell 工具,可以让其它 shell 命令的输出能够自动进入交互翻页模式。 ap 由两部分组成,一个 Go 语言编写的二进制程序,负责捕获命令的输出并支持翻页, 和一组 shell 脚本,负责为用户指定的命令清单创建与之同名的 wrapper。 经

Apr 12, 2022
ntest is a cross-platform cli app that runs multiple tests against any address.
ntest is a cross-platform cli app that runs multiple tests against any address.

ntest ntest is a cross-platform cli app that runs multiple tests against any address. About ntest Having the ability to run common tests against any d

Jan 3, 2022
lsp is like ls command but more human-friendly
lsp is like ls command but more human-friendly

lsp: list files in a mildly human-frendlier manner lsp lists files, like ls command, but it does not attempt to meet that archaic POSIX specification,

Dec 12, 2022
A command line tool for quickly converting Unix timestamps to human readable form.

stamp A command line tool to quickly format a Unix timestamp in a human-readable form. Installation Go is required to build this software. To just bui

Oct 30, 2021
Command line tool for time tracking in a human-readable file format.

klog klog is a plain-text file format and a command line tool for time tracking. ?? Documentation – Learn how to use klog ?? Download – Get the latest

Jan 4, 2023
A command line utility that automagically replaces UNIX timestamps with human interpretable timestamps.

Unfy unfy is a command line utility that automagically identifies and translated UNIX timestamps (since epoch) to human readable timestamps. Example B

Oct 22, 2022