From 0cb88f91631f141b8fe242be11b5ac91d862f01b Mon Sep 17 00:00:00 2001 From: crc Date: Fri, 5 Feb 2021 16:08:17 +0000 Subject: [PATCH] retro-edit: add commands for running program, using shell, using retro-describe FossilOrigin-Name: 085d37058e292c8e51cae21565ba7f025101b90c1c172a5d2529dd9b542c3a22 --- example/retro-edit.retro | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/example/retro-edit.retro b/example/retro-edit.retro index 799af6c..e4625e5 100755 --- a/example/retro-edit.retro +++ b/example/retro-edit.retro @@ -163,6 +163,8 @@ In general, each command is intended to do a single task. | , | | display all lines in the file | | # | | toggle display of line numbers | | / | | search for text; display matching lines | + | ; | | save, then run file via retro | + | ; | text | save, then run text as a shell command | ~~~ {{ @@ -219,6 +221,18 @@ In general, each command is intended to do a single task. ---reveal--- :cmd:W [ @Lines [ write-line nl ] indexed-times ] with-file ; }} + +:cmd:; + @Input dup s:length n:zero? + [ drop #0 script:get-argument 'retro_%s s:format ] if unix:system ; + +&cmd:; $; ed:register-command + +:cmd:? + @Input s:length n:-zero? + [ @Input 'retro-describe_%s s:format unix:system ] if ; + +&cmd:? $? ed:register-command ~~~ ## Register The Commands