Skip to content

Commit

Permalink
Merge pull request #13 from SergeyMi37/master
Browse files Browse the repository at this point in the history
 Add a one-line Z-command
  • Loading branch information
evshvarov authored Oct 18, 2023
2 parents d7cddad + 344e54d commit a1a5e35
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
# isc-one-liners
This is a collection of useful one line commands for ObjectScript. Use and add your own!

## What's new

Added a one-line Z-command.

## Description
Currently it has one-liners of:
* SSL configuration creation
Expand Down
2 changes: 1 addition & 1 deletion module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Document name="dc-one-liners.ZPM">
<Module>
<Name>dc-one-liners</Name>
<Version>1.2.1</Version>
<Version>1.2.2</Version>
<Description>Contains useful ObjectScript one-line long commands. Add your own! </Description>
<Packaging>module</Packaging>
<SourcesRoot>src</SourcesRoot>
Expand Down
12 changes: 12 additions & 0 deletions src/dc/one/Line.cls
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ Include dc.one.Line
Class dc.one.Line
{

/// Add a one-line Z-command
/// Samples:
/// set line="ZPMN(m="""") new $namespace zpm ""zn ""_m_""*"" quit" do ##class(dc.one.Line).AddLineInZZCommand(line)
/// set line="ZPMF(m="""") new $namespace zpm ""ver"" zpm ""repo -list"" zpm ""find ""_m quit" do ##class(dc.one.Line).AddLineInZZCommand(line)
/// set line="ZLIC() new $namespace zn ""%SYS"" do ^CKEY quit" do ##class(dc.one.Line).AddLineInZZCommand(line)
/// set line="ZPIPE(%a) new $namespace zn """_$namespace_""" do cmd^Zpipe(%a) quit" do ##class(dc.one.Line).AddLineInZZCommand(line)
/// set line="ZZJSN(in,out="""") new $namespace zn """_$namespace_""" new res,t,zr set t=$t,zr=$zr set res=$$Do^ZPretty(.in) if (out="""") { write res,! } elseif ($isObject(out) && out.%IsA(""%Stream.Object"")) { do out.Write(res) } else { set @out=res } set $zr=zr if t {} quit" do ##class(dc.one.Line).AddLineInZZCommand(line)
ClassMethod AddLineInZZCommand(line,rou="%ZLANGC00")
{
new $namespace set $namespace="%sys" merge r=^rMAC(rou,0) for i=1:1 { quit:'$DATA(r(i),str) set:$p(str,"(")=$p(line,"(") r(i)=line,yes=1 } if '$GET(yes) { set r(i)=line,r(0)=i } D ROUTINE^%R(rou_".MAC",.r,.err,"CS",0)
}

ClassMethod CreateSSL()
{

Expand Down

0 comments on commit a1a5e35

Please sign in to comment.