bin/maths in maths-0.0.9 vs bin/maths in maths-0.0.10
- old
+ new
@@ -16,12 +16,26 @@
# TODO: Get this working
end
prompt = "maths> "
while command = Readline.readline(prompt, true)
- break if /exit/i =~ command
+ command.strip!
- if command == "vars" || command == "variables"
+ if /exit/i =~ command
+ break
+ elsif /copy/i =~ command
+ begin
+ if Clipboard.implementation
+ Clipboard.copy(Maths::Formatter.format(Maths::Brain.lookup("$")))
+ puts "Copied #{Clipboard.paste} to your system clipboard."
+ puts
+ end
+ rescue
+ puts "Sorry, but clipboard support isn't enabled on your system."
+ puts
+ end
+
+ elsif command == "vars" || command == "variables"
puts
puts "Defined Variables:"
Maths::Brain.read.each do |key, value|
puts "#{key}: #{Maths::Formatter.format(BigDecimal.new(value.to_s))}"
end
\ No newline at end of file