readval

command module
v0.0.0-...-d219e38 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 7 Imported by: 0

README

readval is a command line tool which is designed for one specific purpose—to prompt for a value to be included in another command line. readval prints the prompt on the TTY, reads the input also from the TTY, and echoes the entered input to stdout.

Usage

$ readval -h
usage: ./readval [OPTIONS] prompt...
Prints prompts, reads input from TTY, and echoes it back on stdout.

  -s, --silent          Do not echo input

Examples

$ readval prompt </dev/null | od -c
prompt: foo
0000000   f   o   o  \n
0000004

Or a more "real" example:

$ echo "foo=bar" \
  | curl -s -XPOST -d @- "https://httpbin.org/post?user=$( readval Enter username )&pass=$( readval -s Enter password )" \
  | jq .
Enter username: testuser
Enter password:
{
  "args": {
    "pass": "testpass",
    "user": "testuser"
  },
  "data": "",
  "files": {},
  "form": {
    "foo": "bar"
  },
...

Installation

go install github.com/venkytv/readval@latest

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL