lifesign
8/22/2016 - 10:01 AM

replify - Create a REPL for any command

replify - Create a REPL for any command

See mchav/With for a similar tool that has more features.

HN Discussion

$ replify echo
Initialized REPL for [echo]
echo> "Hello, World!" 
Hello, World!

echo> "It works!"
It works!

$ replify git
Initialized REPL for [git]
git> init
Initialized empty Git repository in /your/directory/here/.git/

git> remote add origin https://your-url/repo.git                

git> checkout -b new-branch
Switched to a new branch 'new-branch'

git> push   
#!/bin/sh

command="${*}"
printf "Initialized REPL for [%s]\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
    eval "$command $input"
    printf "\n%s> " "$command"
    read -r input
done