Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion board/common/rootfs/usr/bin/pager

This file was deleted.

13 changes: 13 additions & 0 deletions board/common/rootfs/usr/bin/pager
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 1 addition & 1 deletion package/klish-plugin-sysrepo/klish-plugin-sysrepo.hash
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion package/klish-plugin-sysrepo/klish-plugin-sysrepo.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package/klish/klish.hash
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Locally calculated
sha256 9d9d33b873917ca5d0bdcc47a36d2fd385971ab0c045d1472fcadf95ee5bcf5b LICENCE
sha256 4293851b355285be3564873fc1f92ce5a3f4386fe8ce1195f18a79b55b5c99ac klish-710a6314c00bc0485221769d73a5b5d6897c1d81-br1.tar.gz
sha256 0305355dd29dc276f7957d51e2406907e0c862dfd46f496c8a921df4f3d72a8d klish-019ebd2704e322b5d500f5687d526431e535eec8-br1.tar.gz
2 changes: 1 addition & 1 deletion package/klish/klish.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/klish-plugin-infix/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
11 changes: 5 additions & 6 deletions src/klish-plugin-infix/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
28 changes: 21 additions & 7 deletions src/klish-plugin-infix/xml/containers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,34 +177,48 @@

<COMMAND name="show" help="Show system status and configuration files" mode="switch">
<COMMAND name="container" help="Show container status">
<ACTION sym="script">doas container show</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
doas container show |pager
</ACTION>

<SWITCH name="optional" min="0">
<COMMAND name="all" help="Show all containers (default only running)">
<ACTION sym="script">doas container -a show</ACTION>
</COMMAND>
<COMMAND name="log" help="Show container log (alias for show log container)">
<ACTION sym="script">doas -u $USER cat /log/container</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
doas -u $USER cat /log/container |pager
</ACTION>
</COMMAND>
<COMMAND name="images" help="Show container images">
<ACTION sym="script">doas container show images</ACTION>
<SWITCH name="optional" min="0">
<COMMAND name="all" help="All images (default hides intermediate imaages)">
<ACTION sym="script">doas container -a show images</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
doas container -a show images |pager
</ACTION>
</COMMAND>
</SWITCH>
</COMMAND>
<COMMAND name="oci" help="Show OCI archives (for loading as image)">
<ACTION sym="script">doas container list oci</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
doas container list oci |pager
</ACTION>
</COMMAND>
<COMMAND name="stat" help="Show continuous containers stats (Ctrl-C aborts)">
<ACTION sym="script">doas container stat</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
doas container stat
</ACTION>
</COMMAND>
<COMMAND name="usage" help="Show container resource usage">
<ACTION sym="script">doas podman system df -v</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
doas podman system df -v
</ACTION>
</COMMAND>
<COMMAND name="volumes" help="Show container volumes">
<ACTION sym="script">doas container show volumes</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
doas container show volumes |pager
</ACTION>
</COMMAND>
</SWITCH>
</COMMAND>
Expand Down
105 changes: 66 additions & 39 deletions src/klish-plugin-infix/xml/infix.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@
<ACTION sym="printl">upgrade</ACTION>
</COMPL>
</PARAM>
<ACTION sym="script">
<ACTION sym="script" in="tty" out="tty" interrupt="true">
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
Expand Down Expand Up @@ -226,27 +226,36 @@
<COMMAND name="show" help="Show system status and configuration files" mode="switch">

<COMMAND name="bridge" help="Show bridge (ports/fdb/mdb/vlans)">
<ACTION sym="script">bridge -color link</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
bridge -color link |pager
</ACTION>

<SWITCH name="optional" min="0">
<COMMAND name="fdb" help="Show unicast forwarding database">
<ACTION sym="script">bridge -color fdb</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
bridge -color fdb |pager
</ACTION>
</COMMAND>
<COMMAND name="mdb" help="Show mulficast forwarding database">
<SWITCH name="optional" min="0">
<COMMAND name="detailed" help="Detailed (full) output">
<ACTION sym="script">bridge -color -d mdb</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
bridge -color -d mdb |pager
</ACTION>
</COMMAND>
</SWITCH>
<ACTION sym="script"> sysrepocfg -d operational -X -f json -x /ietf-interfaces:interfaces | \
/usr/libexec/statd/cli-pretty show-bridge-mdb
<ACTION sym="script" in="tty" out="tty" interrupt="true">
sysrepocfg -d operational -X -f json -x /ietf-interfaces:interfaces | \
/usr/libexec/statd/cli-pretty show-bridge-mdb |pager
</ACTION>
</COMMAND>
<COMMAND name="vlan" help="Show VLAN table">
<ACTION sym="script">bridge -color vlan</ACTION>
<SWITCH name="optional" min="0">
<COMMAND name="detailed" help="Detailed (full) output">
<ACTION sym="script">bridge -color -d vlan</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
bridge -color -d vlan |pager
</ACTION>
</COMMAND>
</SWITCH>
</COMMAND>
Expand All @@ -264,7 +273,9 @@

<COMMAND name="dns" help="Show DNS (client) status">
<!-- Show static/configured nameservers and then all learned ones from DHCP clients -->
<ACTION sym="script">cat /etc/resolv.conf.head 2>/dev/null; resolvconf -l | sed 's/#.*//; /^\s*$/d'</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
cat /etc/resolv.conf.head 2>/dev/null; resolvconf -l | sed 's/#.*//; /^\s*$/d' |pager
</ACTION>
</COMMAND>

<COMMAND name="ntp" help="Show NTP (client) status">
Expand Down Expand Up @@ -306,19 +317,19 @@
<ACTION sym="printl">bfd</ACTION>
</COMPL>
</PARAM>
<ACTION sym="script">
<ACTION sym="script" in="tty" out="tty" interrupt="true">
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
</ACTION>
</COMMAND>
Expand All @@ -330,7 +341,7 @@
<ACTION sym="printl">ipv6</ACTION>
</COMPL>
</PARAM>
<ACTION sym="script">
<ACTION sym="script" in="tty" out="tty" interrupt="true">
case $KLISH_PARAM_ip in
ipv4)
KLISH_PARAM_ip=ip
Expand All @@ -339,14 +350,14 @@
KLISH_PARAM_ip=ipv6
;;
esac
show -p $KLISH_PARAM_ip route
show -p $KLISH_PARAM_ip route |pager
</ACTION>
</COMMAND>

<COMMAND name="hardware" help="Show hardware information">
<ACTION sym="script">
<ACTION sym="script" in="tty" out="tty" interrupt="true">
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
</ACTION>
</COMMAND>

Expand All @@ -358,46 +369,60 @@
</PARAM>
</COMMAND>
</SWITCH>
<ACTION sym="script">
<ACTION sym="script" in="tty" out="tty" interrupt="true">
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
</ACTION>
</COMMAND>

<COMMAND name="ip" help="Show IP level status (Layer-3)">
<ACTION sym="script">ip -color addr</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
ip -color addr |pager
</ACTION>

<SWITCH name="optional" min="0">
<COMMAND name="brief" help="Simplified (human-readable) output" mode="switch">
<ACTION sym="script">ip -color -br addr | sort -V | sed 's/@dsa[0-9]/ /'</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
ip -color -br addr | sort -V | sed 's/@dsa[0-9]/ /' |pager
</ACTION>
</COMMAND>

<COMMAND name="detailed" help="Detailed (full) output" mode="switch">
<ACTION sym="script">ip -color -d addr</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
ip -color -d addr |pager
</ACTION>
</COMMAND>

<COMMAND name="multicast" help="Show IGMP/MLD status" mode="switch">
<ACTION sym="script">mctl</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
mctl |pager
</ACTION>
</COMMAND>

<COMMAND name="route" help="Show IPv4 routing table" mode="switch">
<ACTION sym="script">show -p ip route</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
show -p ip route |pager
</ACTION>
</COMMAND>
</SWITCH>
</COMMAND>

<COMMAND name="ipv6" help="Show IPv6 level status (Layer-3)">
<ACTION sym="script">ip -color -6 addr</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
ip -color -6 addr |pager
</ACTION>

<SWITCH name="optional" min="0">
<COMMAND name="route" help="Show IPv6 routing table" mode="switch">
<ACTION sym="script">show -p ipv6 route</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
show -p ipv6 route |pager
</ACTION>
</COMMAND>
</SWITCH>
</COMMAND>
Expand All @@ -409,7 +434,7 @@
<PARAM name="lines" ptype="/UINT" help="Last number of lines to show"/>
</COMMAND>
</SWITCH>
<ACTION sym="script">
<ACTION sym="script" in="tty" out="tty" interrupt="true">
file=/log/${KLISH_PARAM_fn:-syslog}
case "$file" in
*.gz)
Expand All @@ -422,7 +447,7 @@
if [ -n "$KLISH_PARAM_lines" ]; then
$cmd "$file" | tail -n $KLISH_PARAM_lines
else
$cmd "$file"
$cmd "$file" | pager
fi
</ACTION>
</COMMAND>
Expand All @@ -436,24 +461,26 @@
</COMMAND>
-->
<COMMAND name="version" help="Show software version">
<ACTION sym="script">cat /etc/version</ACTION>
<ACTION sym="script" in="tty" interrupt="true">cat /etc/version</ACTION>
</COMMAND>

<COMMAND name="factory-config" help="Show factory-config">
<ACTION sym="script">jq -C . /etc/factory-config.cfg</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">jq -C . /etc/factory-config.cfg |pager</ACTION>
</COMMAND>

<COMMAND name="running-config" help="Show running-config">
<ACTION sym="script">sysrepocfg -X -f json | jq -C .</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">sysrepocfg -X -f json | jq -C . |pager</ACTION>
</COMMAND>

<COMMAND name="startup-config" help="Show startup-config">
<ACTION sym="script">jq -C . /cfg/startup-config.cfg</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">jq -C . /cfg/startup-config.cfg |pager</ACTION>
</COMMAND>
</COMMAND>
<COMMAND name="factory-reset" help="Restore the system to factory default state">
<ACTION sym="script" in="tty" out="tty" interrupt="true">/bin/yorn "This will restore the device to factory defaults"</ACTION>
<ACTION sym="srp_rpc@sysrepo">/ietf-factory-default:factory-reset</ACTION>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
/bin/yorn "This will restore the device to factory defaults"
</ACTION>
<ACTION sym="srp_rpc@sysrepo">/ietf-factory-default:factory-reset</ACTION>
</COMMAND>

<COMMAND name="follow" help="Monitor a log file, use Ctrl-C to abort">
Expand All @@ -469,7 +496,7 @@
<PARAM name="addrlen" ptype="/STRING" help="ADDRESS[/LEN]"/>
<PARAM name="netmask" ptype="/STRING" min="0" help="Optional NETMASK"/>
<PARAM name="split" ptype="/UINT" min="0" help="Split network: 1-32 (IPv4), 1-128 (IPv6)"/>
<ACTION sym="script">
<ACTION sym="script" in="tty" out="tty" interrupt="true">
if [ -n "$KLISH_PARAM_split" ]; then
if echo $KLISH_PARAM_addrlen |grep -q ':'; then
split="-S $KLISH_PARAM_split"
Expand Down