Skip to content

Instantly share code, notes, and snippets.

@danjesus
Forked from postpostscript/ replify
Created August 26, 2016 21:25
Show Gist options
  • Save danjesus/b5dd166dde46dfa9803d2430f3389042 to your computer and use it in GitHub Desktop.
Save danjesus/b5dd166dde46dfa9803d2430f3389042 to your computer and use it in GitHub Desktop.
replify - Create a REPL for any command
#!/bin/sh
command="${*}"
printf "Initialized REPL for `%s`\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
eval "$command $input"
printf "%s> " "$command"
read -r input
done

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
git clone https://gist.github.com/bb88e3dad565c0d8ee54031f6b758a09.git ./replify && cd ./replify && mv ./" replify" ./replify && sudo chmod +x ./replify && sudo ln -s `pwd`/replify /usr/bin/replify

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment