summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2019-01-24 00:27:31 +0000
committerKatolaZ <katolaz@freaknet.org>2019-01-24 00:27:31 +0000
commit34237770f9903118b28f428ceef2a665eacc9e60 (patch)
tree18605514fb2058464ddca2f52ec14e815d3e6f16
parentda1b7d16405eca03fd31dcbad33485b078dd7125 (diff)
add 'show' and allow custom prompt
-rwxr-xr-xgophed11
-rw-r--r--show1
2 files changed, 8 insertions, 4 deletions
diff --git a/gophed b/gophed
index a6d7561..e62950a 100755
--- a/gophed
+++ b/gophed
@@ -1,5 +1,7 @@
#!/bin/sh
+PROMPT="=="
+SHOW="show"
cleanup () {
rm -f $TMPFILE;
@@ -36,17 +38,18 @@ if [ "$1" = "-h" ]; then usage; fi
if [ "$1" = "-i" ]; then
ln -s $0 g
- ln -s $0 d
+ ln -s $0 d
+ ln -s $0 v
exit 0
fi
script_name=$(basename $0)
-if [ "${script_name}" = "gophed" ]; then
+if [ "${script_name}" = "gophed" -o "${script_name}" = "v" ]; then
sel=$(echo $1 | sed -r 's:/:+:g')
TMPFILE=$(mktemp /tmp/gophed_$2_${sel}_$3.XXXXXXXXXXXXXXXXXXX)
go "$1" "$2" "$3" > $TMPFILE
- cat show - show | ed $TMPFILE
+ cat $SHOW - | ed -p ${PROMPT} $TMPFILE
fi
if [ "${script_name}" = "g" ]; then
LINE=$(awk "{if (NR == $2) print \$0;}" $1)
@@ -56,7 +59,7 @@ if [ "${script_name}" = "g" ]; then
SEL=$(echo $RESOURCE | sed -r 's:/:+:g')
TMPFILE=$(mktemp /tmp/gophed_${HOST}_${SEL}_${PORT}.XXXXXXXXXXXXXXXXXXX)
go "$RESOURCE" "$HOST" "$PORT" > $TMPFILE
- cat show - show | ed $TMPFILE
+ cat $SHOW - | ed -p ${PROMPT} $TMPFILE
fi
if [ "${script_name}" = "d" ]; then
LINE=$(awk "{if (NR == $2) print \$0;}" $1)
diff --git a/show b/show
new file mode 100644
index 0000000..9342352
--- /dev/null
+++ b/show
@@ -0,0 +1 @@
+%n