чување 2a82cd3da07d1d7269f7d46f2d9e46eddad04ff9
родитељ fbf11f2b50bda1d9e1320321279a03b80b039d55
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Mon, 14 Feb 2022 12:13:38 +0100
sledv: New file; README: Mention sledv
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 2, додавања: 22(+), брисања: 0(-)
diff --git a/README b/README
@@ -16,6 +16,9 @@ A: A text editor's purpose should be to *edit* text files. For just *viewing*
text file viewers, but I think of displaying the contents of a writable file
as separate from displaying the contents of a non-writable file.
+ If this bothers you, you can use something like the included shell script
+ sledv.
+
Q: Is editing multiple files planned?
A: No, this is by design. You can edit multiple files at the same time by
running multiple instances of sled. You can arrange them on screen through a
diff --git a/sledv b/sledv
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+if [ $# -lt 1 ]; then
+ cat <<EOT >&2
+Usage: ${0##*/} [path] [arguments]
+ Test if path is writable; if it is, execute 'sled [arguments] [path]',
+ otherwise 'less [arguments] [path]'.
+EOT
+ exit 1
+fi
+
+path=$1
+shift
+
+if test -w "$path"; then
+ sled "$@" "${path}"
+else
+ less "$@" "${path}"
+fi