diff --git a/board/common/rootfs/usr/bin/pager b/board/common/rootfs/usr/bin/pager deleted file mode 120000 index 9ff824547..000000000 --- a/board/common/rootfs/usr/bin/pager +++ /dev/null @@ -1 +0,0 @@ -less \ No newline at end of file diff --git a/board/common/rootfs/usr/bin/pager b/board/common/rootfs/usr/bin/pager new file mode 100755 index 000000000..d307f92b9 --- /dev/null +++ b/board/common/rootfs/usr/bin/pager @@ -0,0 +1,13 @@ +#!/bin/sh +# -d ;; suppress error message "the terminal is dumb" +# -F :: exit if the entire file can be displayed on the first screen +# -I :: Ignore case, even for patterns +# -K :: exit immediately when an interrupt character (usually ^C) is typed +# -R :: Almost raw control charachters, only ANSI color escape sequences and +# OSC 8 hyperlink sequences are output. Allows veritcal scrolling +# -S :: lines longer than the screen width are chopped (truncated), not wrapped +# -X :: No termcap initialization and deinitialization set to the terminal. +# This is what leaves the contents of the output on screen. + +export LESS="-P %f (press h for help or q to quit)" +less -RISKd -FX "$@" diff --git a/package/klish-plugin-sysrepo/klish-plugin-sysrepo.hash b/package/klish-plugin-sysrepo/klish-plugin-sysrepo.hash index 736db0db8..210eba633 100644 --- a/package/klish-plugin-sysrepo/klish-plugin-sysrepo.hash +++ b/package/klish-plugin-sysrepo/klish-plugin-sysrepo.hash @@ -1,3 +1,3 @@ # Locally calculated sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE -sha256 58b6b271912f9331ea78a815a8cec073924b423403868dd9fcc48de0942f49f8 klish-plugin-sysrepo-213cd51aa8863e7ef66944137db3dffc88d58cc1-br1.tar.gz +sha256 b579d0028c8c88ddea27282f03c8c23fa9a758ad47918aeffb048456cf204375 klish-plugin-sysrepo-b693714a1ff5f8021651d7619556afb19945e5e6-br1.tar.gz diff --git a/package/klish-plugin-sysrepo/klish-plugin-sysrepo.mk b/package/klish-plugin-sysrepo/klish-plugin-sysrepo.mk index 8a9fef3d1..3af001ba5 100644 --- a/package/klish-plugin-sysrepo/klish-plugin-sysrepo.mk +++ b/package/klish-plugin-sysrepo/klish-plugin-sysrepo.mk @@ -4,7 +4,7 @@ # ################################################################################ -KLISH_PLUGIN_SYSREPO_VERSION = 213cd51aa8863e7ef66944137db3dffc88d58cc1 +KLISH_PLUGIN_SYSREPO_VERSION = b693714a1ff5f8021651d7619556afb19945e5e6 KLISH_PLUGIN_SYSREPO_SITE = https://github.com/kernelkit/klish-plugin-sysrepo.git #KLISH_PLUGIN_SYSREPO_VERSION = cdd3eb51a7f7ee0ed5bd925fa636061d3b1b85fb #KLISH_PLUGIN_SYSREPO_SITE = https://src.libcode.org/pkun/klish-plugin-sysrepo.git diff --git a/package/klish/klish.hash b/package/klish/klish.hash index faf035455..9153dfb70 100644 --- a/package/klish/klish.hash +++ b/package/klish/klish.hash @@ -1,3 +1,3 @@ # Locally calculated sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE -sha256 4293851b355285be3564873fc1f92ce5a3f4386fe8ce1195f18a79b55b5c99ac klish-710a6314c00bc0485221769d73a5b5d6897c1d81-br1.tar.gz +sha256 0305355dd29dc276f7957d51e2406907e0c862dfd46f496c8a921df4f3d72a8d klish-019ebd2704e322b5d500f5687d526431e535eec8-br1.tar.gz diff --git a/package/klish/klish.mk b/package/klish/klish.mk index 9cf8311b7..fcf8b6318 100644 --- a/package/klish/klish.mk +++ b/package/klish/klish.mk @@ -4,7 +4,7 @@ # ################################################################################ -KLISH_VERSION = 710a6314c00bc0485221769d73a5b5d6897c1d81 +KLISH_VERSION = 019ebd2704e322b5d500f5687d526431e535eec8 KLISH_SITE = https://github.com/kernelkit/klish.git #KLISH_VERSION = tags/3.0.0 #KLISH_SITE = https://src.libcode.org/pkun/klish.git diff --git a/src/klish-plugin-infix/configure.ac b/src/klish-plugin-infix/configure.ac index fa8f2bc7f..9db70db0c 100644 --- a/src/klish-plugin-infix/configure.ac +++ b/src/klish-plugin-infix/configure.ac @@ -50,9 +50,6 @@ AS_IF([test "x$with_shell" != "xno"], [ test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -KLISHLIBDIR=`eval echo $libdir/klish` -AC_SUBST(KLISHLIBDIR) - KLISHCONFDIR=`eval echo $sysconfdir/klish` AC_SUBST(KLISHCONFDIR) diff --git a/src/klish-plugin-infix/src/Makefile.am b/src/klish-plugin-infix/src/Makefile.am index 18ad1bb17..3f0b64e82 100644 --- a/src/klish-plugin-infix/src/Makefile.am +++ b/src/klish-plugin-infix/src/Makefile.am @@ -1,10 +1,9 @@ AM_CPPFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE -D_GNU_SOURCE CFLAGS = -Wall -Wextra -Werror -Wno-unused-parameter -pluginsdir = $(KLISHLIBDIR)/plugins -plugins_LTLIBRARIES = kplugin-infix.la +lib_LTLIBRARIES = libklish-plugin-infix.la -kplugin_infix_la_CFLAGS = $(sysrepo_CFLAGS) $(klish_CFLAGS) $(libyang_CFLAGS) $(CFLAGS) -kplugin_infix_la_LIBADD = $(sysrepo_LIBS) $(klish_LIBS) $(libyang_LIBS) -kplugin_infix_la_LDFLAGS = -module -avoid-version -shared -kplugin_infix_la_SOURCES = infix.c +libklish_plugin_infix_la_CFLAGS = $(sysrepo_CFLAGS) $(klish_CFLAGS) $(libyang_CFLAGS) $(CFLAGS) +libklish_plugin_infix_la_LIBADD = $(sysrepo_LIBS) $(klish_LIBS) $(libyang_LIBS) +libklish_plugin_infix_la_LDFLAGS = -module -avoid-version -shared +libklish_plugin_infix_la_SOURCES = infix.c diff --git a/src/klish-plugin-infix/xml/containers.xml b/src/klish-plugin-infix/xml/containers.xml index af8bd610c..45ffcbb2d 100644 --- a/src/klish-plugin-infix/xml/containers.xml +++ b/src/klish-plugin-infix/xml/containers.xml @@ -177,34 +177,48 @@ - doas container show + + doas container show |pager + doas container -a show - doas -u $USER cat /log/container + + doas -u $USER cat /log/container |pager + doas container show images - doas container -a show images + + doas container -a show images |pager + - doas container list oci + + doas container list oci |pager + - doas container stat + + doas container stat + - doas podman system df -v + + doas podman system df -v + - doas container show volumes + + doas container show volumes |pager + diff --git a/src/klish-plugin-infix/xml/infix.xml b/src/klish-plugin-infix/xml/infix.xml index abbb6cb25..f687bc12d 100644 --- a/src/klish-plugin-infix/xml/infix.xml +++ b/src/klish-plugin-infix/xml/infix.xml @@ -133,11 +133,11 @@ upgrade - + topic=${KLISH_PARAM_topic:-quick} fn="/usr/share/infix/cli/${topic}.md" if [ -f "$fn" ]; then - lowdown -t term --term-vmargin=1 "$fn" + lowdown -t term --term-vmargin=1 "$fn" |pager else echo "Help topic not available, try help without an argument, or tap '?' for a list." fi @@ -226,27 +226,36 @@ - bridge -color link + + bridge -color link |pager + - bridge -color fdb + + bridge -color fdb |pager + - bridge -color -d mdb + + bridge -color -d mdb |pager + - sysrepocfg -d operational -X -f json -x /ietf-interfaces:interfaces | \ - /usr/libexec/statd/cli-pretty show-bridge-mdb + + sysrepocfg -d operational -X -f json -x /ietf-interfaces:interfaces | \ + /usr/libexec/statd/cli-pretty show-bridge-mdb |pager bridge -color vlan - bridge -color -d vlan + + bridge -color -d vlan |pager + @@ -264,7 +273,9 @@ - cat /etc/resolv.conf.head 2>/dev/null; resolvconf -l | sed 's/#.*//; /^\s*$/d' + + cat /etc/resolv.conf.head 2>/dev/null; resolvconf -l | sed 's/#.*//; /^\s*$/d' |pager + @@ -306,19 +317,19 @@ bfd - + if [ -z "$KLISH_PARAM_name" ]; then - doas vtysh -c "show ip ospf" + doas vtysh -c "show ip ospf" |pager elif [ "$KLISH_PARAM_name" == "neighbor" ];then - doas vtysh -c "show ip ospf neighbor" + doas vtysh -c "show ip ospf neighbor" |pager elif [ "$KLISH_PARAM_name" == "interfaces" ];then - doas vtysh -c "show ip ospf interface" + doas vtysh -c "show ip ospf interface" |pager elif [ "$KLISH_PARAM_name" == "routes" ];then - doas vtysh -c "show ip ospf route" + doas vtysh -c "show ip ospf route" |pager elif [ "$KLISH_PARAM_name" == "database" ];then - doas vtysh -c "show ip ospf database" + doas vtysh -c "show ip ospf database" |pager elif [ "$KLISH_PARAM_name" == "bfd" ];then - doas vtysh -c "show bfd peers" + doas vtysh -c "show bfd peers" |pager fi @@ -330,7 +341,7 @@ ipv6 - + case $KLISH_PARAM_ip in ipv4) KLISH_PARAM_ip=ip @@ -339,14 +350,14 @@ KLISH_PARAM_ip=ipv6 ;; esac - show -p $KLISH_PARAM_ip route + show -p $KLISH_PARAM_ip route |pager - + sysrepocfg -f json -X -d operational -x "/ietf-hardware:hardware" | \ - /usr/libexec/statd/cli-pretty "show-hardware" + /usr/libexec/statd/cli-pretty "show-hardware" |pager @@ -358,46 +369,60 @@ - + if [ -n "$KLISH_PARAM_name" ]; then sysrepocfg -f json -X -d operational -x \ "/ietf-interfaces:interfaces/interface[name=\"$KLISH_PARAM_name\"]" | \ - /usr/libexec/statd/cli-pretty "show-interfaces" -n "$KLISH_PARAM_name" + /usr/libexec/statd/cli-pretty "show-interfaces" -n "$KLISH_PARAM_name" |pager else sysrepocfg -f json -X -d operational -m ietf-interfaces | \ - /usr/libexec/statd/cli-pretty "show-interfaces" + /usr/libexec/statd/cli-pretty "show-interfaces" |pager fi - ip -color addr + + ip -color addr |pager + - ip -color -br addr | sort -V | sed 's/@dsa[0-9]/ /' + + ip -color -br addr | sort -V | sed 's/@dsa[0-9]/ /' |pager + - ip -color -d addr + + ip -color -d addr |pager + - mctl + + mctl |pager + - show -p ip route + + show -p ip route |pager + - ip -color -6 addr + + ip -color -6 addr |pager + - show -p ipv6 route + + show -p ipv6 route |pager + @@ -409,7 +434,7 @@ - + file=/log/${KLISH_PARAM_fn:-syslog} case "$file" in *.gz) @@ -422,7 +447,7 @@ if [ -n "$KLISH_PARAM_lines" ]; then $cmd "$file" | tail -n $KLISH_PARAM_lines else - $cmd "$file" + $cmd "$file" | pager fi @@ -436,24 +461,26 @@ --> - cat /etc/version + cat /etc/version - jq -C . /etc/factory-config.cfg + jq -C . /etc/factory-config.cfg |pager - sysrepocfg -X -f json | jq -C . + sysrepocfg -X -f json | jq -C . |pager - jq -C . /cfg/startup-config.cfg + jq -C . /cfg/startup-config.cfg |pager - /bin/yorn "This will restore the device to factory defaults" - /ietf-factory-default:factory-reset + + /bin/yorn "This will restore the device to factory defaults" + + /ietf-factory-default:factory-reset @@ -469,7 +496,7 @@ - + if [ -n "$KLISH_PARAM_split" ]; then if echo $KLISH_PARAM_addrlen |grep -q ':'; then split="-S $KLISH_PARAM_split"