blob: 75811b678bc66ce3198c979c097c34fea80e46cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package bjc.dicelang.neodice.commands;
import static bjc.dicelang.neodice.statements.VoidStatementValue.*;
import java.util.*;
import bjc.dicelang.neodice.*;
import bjc.dicelang.neodice.statements.*;
/**
* A command that shows all of the currently bound variables.
*
* @author Ben Culkin
*
*/
public class ShowBindingsCommand implements Command {
@Override
public StatementValue execute(Iterator<String> words, DieBoxCLI state) {
state.output.printf("Showing all %d variables currently bound:", state.bindings.size());
state.bindings.forEach((name, bound) -> {
state.output.printf("\t%t\t%s\n", name, bound);
});
return VOID_INST;
}
@Override
public String shortHelp() {
return "print out all the variable bindings";
}
@Override
public String longHelp() {
return "Prints out all of the variable bindings that exist at the moment";
}
}
|