resc
is a CLI tool that executes remote bash scripts located on Github on your local machine. This allows you to:
- Share your scripts easily
- Run your scripts everywhere (as long as it is a mac or linux machine 😉)
$ wget -O /usr/local/bin/resc https://github.com/JulzDiverse/resc/releases/download/v0.4.0/resc-darwin-amd64 && chmod +x /usr/local/bin/resc
OR
Homebrew
$ brew tap julzdiverse/tools
$ brew install resc
$ wget -O /usr/bin/resc https://github.com/JulzDiverse/resc/releases/download/v0.4.0/resc-linux-amd64 && chmod +x /usr/bin/resc
You can use resc
to run resc
scripts located in any Github repository. For example, let's run a Hello, World!
script:
$ resc run hello-world --repo JulzDiverse/remote-scripts
This runs the hello-world
script located in the JulzDiverse/remote-scripts
repository.
resc
scripts require one or more top level directories inside a GitHub repository that contain a run.sh
script, a .resc
, and a README.md
file. In case of the hello-world
script the directory looks like this:
.remote-scripts
└── hello-world
├── .resc
├── run.sh
└── README.md
- The
directory name
(herehello-world
) indicates the script name - The
.resc
is an empty file that indicates that the directoy is aresc
script directory - The
run.sh
is the bash script that is run byresc
- The
README.md
is a Markdown file that provides information for a script (eg description, usage). TheREADME.md
is processed by theresc
CLI and should only contain the following markdown syntax:- H1 (#)
- H2 (##)
- Bold (**text**)
- Italic (_text_)
Running a resc
script is nothing more than:
$ resc run <script-name> --repo <github-user|github-org>/<github-repo>
or if you have set a default repository, it's even simpler:
$ resc run <script-name>
You can provide parameters to a script using --args|-a
option. Try it:
$ resc run hello-world -r JulzDiverse/remote-scripts -a your-name
You can also run a specific script located anywhere in a repository by providing the path to the script:
$ resc run -s <path/to/script.sh> -r JulzDiverse/remote-scripts
You can set a default resc
script repository, s.t you are not required to specify the repository of a script everytime you execute the resc run
.
$ resc set <github-user|github-org>/<github-repo>
If you want to know which resc
scripts a repository provides, you can list all of them using list
.
If you have set a default repository you can run just:
$ resc list
If you want to list scripts of a specific repository, run:
$ resc list <github-user>/<github-repo>
If you want to know what a script does before you run it, you can check the provided README by calling man
:
$ resc man <script-name>
If you want to see what a script exactly does or you want to save it to your local machine, you can use the print
command:
$ resc print <script-name>
to save a script, pipe it to a file:
$ resc print <script-name> > script.sh
Each resc
command has the --branch|-b
option, where you can specify a specific branch of a repository you want to use to execute a script. For example:
$ resc run hello-world -r JulzDiverse/remote-scripts -b develop
The default branch used is always master
. You can, however, set a default branch if required:
# if you have set your defaults already:
$ resc set -b develop
# if you haven't set your defaults:
$ resc set <owner>/<repo> -b develop
$ go get github.com/JulzDiverse/resc (or git clone repository)
$ dep ensure