Skip to content

Commit

Permalink
Added Variable Command for getting selected options data
Browse files Browse the repository at this point in the history
  • Loading branch information
majenkotech committed Dec 20, 2014
1 parent 953e959 commit 8ef93d0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/org/uecide/varcmd/vc_option.java
@@ -0,0 +1,30 @@
package org.uecide.varcmd;

import org.uecide.*;

public class vc_option implements VariableCommand {
public String main(Sketch sketch, String args) {

String[] bits = args.split("\\.");

if (bits.length != 2) {
return "ERR1";
}

String opt = bits[0];
String key = bits[1];
String optval = sketch.getOption(opt);

if (optval == null) {
return "ERR2";
}

String val = "options." + opt + "." + optval + "." + key;
PropertyFile props = sketch.mergeAllProperties();
String retval = props.get(val);
if (retval == null) {
return "ERR3";
}
return retval;
}
}

0 comments on commit 8ef93d0

Please sign in to comment.