add function to run from target directory
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/bin/sh
|
||||
# sfm - Simple File Manager in POSIX sh
|
||||
# sfm - Simple File Manager in POSIX sh (flicker-free)
|
||||
# version 0.3
|
||||
|
||||
# --- terminal control ---
|
||||
tput_cmd() { command -v tput >/dev/null 2>&1 && tput "$@"; }
|
||||
@@ -61,7 +62,11 @@ term_rows() { tput_cmd lines || echo 24; }
|
||||
term_cols() { tput_cmd cols || echo 80; }
|
||||
|
||||
# --- state ---
|
||||
CWD="$PWD"; CWD=$(cd "$CWD" 2>/dev/null && pwd) || CWD="/"
|
||||
if [ -n "$1" ]; then
|
||||
CWD=$(cd "$1" 2>/dev/null && pwd) || { printf 'sfm: %s: no such directory\n' "$1" >&2; exit 1; }
|
||||
else
|
||||
CWD=$(cd "$PWD" 2>/dev/null && pwd) || CWD="/"
|
||||
fi
|
||||
SEL=0
|
||||
OFFSET=0
|
||||
PREV_SEL=0
|
||||
|
||||
Reference in New Issue
Block a user