Written by

Senior Startups and Community Programs Manager at InterSystems Corporation
Question Evgeny Shvarov · Jun 28, 2020

Multiline code in terminal

Hi, folks!

Do you know the option/mode when I can feed multiline code into a terminal?

E.g. 

for i=1:1:100 {

/// do one line

///do something else}

Comments

Robert Cemper · Jun 28, 2020

use local routine. like:

a<tab>for i=1:1:100 {
<tab>/// do one line
<tab>///do something else
<tab>}
do a   ;to run it

to edit/show  your line use ZI, ZR, PRINT  

ATTENTION: you need a REAL terminal. 
WebTerm, Studio, .... just can process  single lines as they are only Terminal SIMULATIONS using eXECUTE command

0
Robert Cemper  Jun 28, 2020 to Robert Cemper

If you call routines or classes you should temporarily save your lines before execution
e.g.  ZS temp

0
Evgeny Shvarov  Jun 28, 2020 to Robert Cemper

Oh. Or make a small program, which does the thing - multiline editor for terminal. very simple. Just to have an option copy-paste several lines of code and run it in terminal

0
Robert Cemper  Jun 28, 2020 to Evgeny Shvarov

exact!  
ZS temp creates temp.int

0
Evgeny Shvarov  Jun 29, 2020 to Eduard Lebedyuk

Cool! Wanted something like that for ObjectScript

0
Evgeny Shvarov  Jun 29, 2020 to Robert Cemper

Wow. This is fast! Thanks Robert!

Need a zpm package ;)

0
Jeffrey Drumm  Jun 30, 2020 to Robert Cemper

Would you like us to post feature requests here, on GitHub, or not at all? laugh

For example, I want to be able to go back and edit a previously entered line before execution ...

0
Robert Cemper  Jun 30, 2020 to Jeffrey Drumm

Pls. use GitHub.
That makes it easier to follow and complete

0
Evgeny Shvarov  Jul 1, 2020 to Evgeny Shvarov

In fact, It works!

Installation:

USER>zpm
zpm: USER>install terminal-multiline

[terminal-multiline]    Reload START
[terminal-multiline]    Reload SUCCESS
[terminal-multiline]    Module object refreshed.
[terminal-multiline]    Validate START
[terminal-multiline]    Validate SUCCESS
[terminal-multiline]    Compile START
[terminal-multiline]    Compile SUCCESS
[terminal-multiline]    Activate START
[terminal-multiline]    Configure START
[terminal-multiline]    Configure SUCCESS
[terminal-multiline]    Activate SUCCESS
zpm: USER>q

Usage with copy-n-paste from docs:

USER>d ^%zml
Entering multi line mode. Run with empty line. Stop with single "."
USER:zml:1> SET x=8
USER:zml:2>   FOR { WRITE "Running loop x=",x,!
USER:zml:3>         SET x=x-1
USER:zml:4>         QUIT:x=3
USER:zml:5>       }
USER:zml:6>   WRITE "Next command after FOR code block"
USER:zml:7> 
Running loop x=8
Running loop x=7
Running loop x=6
Running loop x=5
Running loop x=4

Next command after FOR code block
USER:zml:1>

It works like a charm!

Bravo, @Robert Cemper!

0