Skip to content

venkytv/readval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A command line tool to prompt for a value to be included in another command line.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages