Browse Source

add 'show' and allow custom prompt

master
KatolaZ 4 years ago
parent
commit
34237770f9
  1. 11
      gophed
  2. 1
      show

11
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)

1
show

@ -0,0 +1 @@
%n
Loading…
Cancel
Save