Skip to content

Commit e5ee616

Browse files
Add print Pcl command.
1 parent 15b0afc commit e5ee616

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

  • praxiscore-script/src/main/java/org/praxislive/script/commands

praxiscore-script/src/main/java/org/praxislive/script/commands/BaseCmds.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright 2024 Neil C Smith.
4+
* Copyright 2025 Neil C Smith.
55
*
66
* This code is free software; you can redistribute it and/or modify it
77
* under the terms of the GNU Lesser General Public License version 3 only, as
@@ -45,6 +45,7 @@ class BaseCmds {
4545
private static final Set SET = new Set();
4646
private static final Var VAR = new Var();
4747
private static final Echo ECHO = new Echo();
48+
private static final Print PRINT = new Print();
4849

4950
private BaseCmds() {
5051
}
@@ -54,6 +55,7 @@ static void install(Map<String, Command> commands) {
5455
commands.put("set", SET);
5556
commands.put("var", VAR);
5657
commands.put("echo", ECHO);
58+
commands.put("print", PRINT);
5759
}
5860

5961
private static class Set implements InlineCommand {
@@ -119,4 +121,16 @@ public List<Value> process(Env context, Namespace namespace, List<Value> args) t
119121

120122
}
121123

124+
private static class Print implements InlineCommand {
125+
126+
@Override
127+
public List<Value> process(Env context, Namespace namespace, List<Value> args) throws Exception {
128+
if (args.size() != 1) {
129+
throw new Exception();
130+
}
131+
return List.of(PString.of(args.get(0).print()));
132+
}
133+
134+
}
135+
122136
}

0 commit comments

Comments
 (0)