Skip to content

Commit eeef9e5

Browse files
committed
miniscript-run:install
1 parent 4c91d9e commit eeef9e5

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

miniscript-run

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
function help(){
4+
echo "miniscript-run '<miniscript>'";
5+
echo "miniscript-run 'pk_h(test)'";exit
6+
}
7+
if [[ "$1" == "help" ]] || [[ "$1" == "-h" ]]; then
8+
help; exit
9+
fi
10+
11+
function install(){
12+
13+
[ ! -d miniscript ] && \
14+
$(which git) clone --depth 1 https://github.com/sipa/miniscript.git
15+
16+
cd miniscript && \
17+
make >/dev/null && \
18+
install miniscript /usr/local/bin 2>/dev/null && \
19+
file miniscript && \
20+
cd .. || file echo $(which miniscript);
21+
22+
[[ -z "$(command -v miniscript-run)" ]] && \
23+
install $0 /usr/local/bin || \
24+
echo $(which miniscript-run);exit
25+
}
26+
if [[ "$1" == "install" ]]; then
27+
install; exit
28+
fi
29+
#
30+
for var in "$@"
31+
do
32+
echo "$var" | $(which miniscript) 2>/dev/null;exit || \
33+
echo "$var" | ./miniscript/miniscript;exit || help
34+
done
35+
help

0 commit comments

Comments
 (0)