mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-06 23:43:20 +02:00
src/klish-plugin-infix: fixes to 'dir' and 'show log' commands
These changes are designed to make the experience working with log files easier. Both listing available log files and viewing them. - replace C dir@infix with a shell script for easier extensions, e.g., we want to show both available .cfg and log files - add support for gunzipping .gz log files before viewing them Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
dir()
|
||||
{
|
||||
path=$1
|
||||
|
||||
if [ -z "$COLUMS" ]; then
|
||||
TTY=$(resize)
|
||||
eval "$TTY"
|
||||
fi
|
||||
|
||||
printf "\033[7m%-*s\033[0m\n" "$COLUMNS" "$path directory"
|
||||
if [ -d "$path" ]; then
|
||||
ls -p "$path/"
|
||||
else
|
||||
echo "Directory $path does not exist."
|
||||
fi
|
||||
echo
|
||||
}
|
||||
|
||||
if [ -d "$1" ]; then
|
||||
dir "$1"
|
||||
else
|
||||
dir "$HOME"
|
||||
dir "/cfg"
|
||||
dir "/log"
|
||||
fi
|
||||
Reference in New Issue
Block a user