summaryrefslogtreecommitdiffstats
path: root/src/scripts/rename-stdin.lnav
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/scripts/rename-stdin.lnav12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/scripts/rename-stdin.lnav b/src/scripts/rename-stdin.lnav
new file mode 100644
index 0000000..10a54b6
--- /dev/null
+++ b/src/scripts/rename-stdin.lnav
@@ -0,0 +1,12 @@
+#
+# @synopsis: rename-stdin <name>
+# @description: Give a symbolic name to the standard-input file
+#
+
+;SELECT raise_error('expecting the new name for stdin as the first argument') WHERE $1 IS NULL
+;SELECT raise_error('no data was redirected to lnav''s standard-input')
+ WHERE (SELECT count(1) FROM lnav_file WHERE filepath='stdin') = 0
+
+;UPDATE lnav_file SET filepath=$1 WHERE filepath='stdin'
+
+;SELECT 'info: renamed stdin to ' || $1 AS msg