Skip to content

Commit

Permalink
display prompt in pager
Browse files Browse the repository at this point in the history
  • Loading branch information
phyver committed Jun 21, 2021
1 parent d80867e commit 532b460
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 6 deletions.
2 changes: 0 additions & 2 deletions bin/_gsh_index
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh

. gettext.sh

n=1
while read -r mission_dir
do
Expand Down
13 changes: 11 additions & 2 deletions bin/pager
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/bin/sh

if command -v less > /dev/null 2>&1
TEXTDOMAIN=gsh


if [ -n "$PAGER" ]
then
$PAGER "$@"
elif command -v less > /dev/null 2>&1
then
less -rEX "$@"
LESS= less -rEX -Ps"$(gettext '[Press space to continue, 'q' to quit\.]')$" \
-Pm"$(gettext '[Press space to continue, 'q' to quit\.]')$" \
-PM"$(gettext '[Press space to continue, 'q' to quit\.]')$" \
"$@"
else
more "$@"
fi
Expand Down
2 changes: 0 additions & 2 deletions bin/progress_bar
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

# display a small animation until the given PID stops

. gettext.sh

TEXTDOMAIN=gsh

get_design() {
Expand Down
3 changes: 3 additions & 0 deletions i18n/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ msgstr "While you are waiting, you see a fish swimming in circles..."
msgid "Y"
msgstr "Y"

msgid "[Press space to continue, q to quit\\.]"
msgstr "[Press space to continue, q to quit\\.]"

msgid "cancelled"
msgstr "cancelled"

Expand Down
3 changes: 3 additions & 0 deletions i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ msgstr "Pendant que vous attendez, un poisson fait des ronds..."
msgid "Y"
msgstr "O"

msgid "[Press space to continue, q to quit\\.]"
msgstr "[Appuyer sur la barre d'espace pour continuer, 'q' pour quitter\\.]"

msgid "cancelled"
msgstr "annulée"

Expand Down
3 changes: 3 additions & 0 deletions i18n/template.pot
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ msgstr ""
msgid "Y"
msgstr ""

msgid "[Press space to continue, q to quit\\.]"
msgstr ""

msgid "cancelled"
msgstr ""

Expand Down
10 changes: 10 additions & 0 deletions lib/gshrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ export PS2="> "
export PS3=""
export PS4="+ "

# choose appropriate pager
unset PAGER
tempfile=$(mktemp)
echo "TEST" | "$GSH_ROOT/bin/pager" 2>"$tempfile" >/dev/null
if [ -s "$tempfile" ]
then
export PAGER=more
fi
rm -f "$mktemp"

# try to prevent using sudo and similar
su() {
echo "gsh: su: command not found" >&2
Expand Down

0 comments on commit 532b460

Please sign in to comment.