rakeshbs/solidity_compiler_helper

It would be nice to have command-line arguments

bortzmeyer opened this issue · 0 comments

Very useful tool for deploying the contracts. However, I would like to run it entirely from the command-line, without interactive requests. Here is a proposed patch:

diff --git a/solc_helper b/solc_helper
index e15dc7f..178b59f 100755
--- a/solc_helper
+++ b/solc_helper
@@ -57,7 +57,6 @@ end
 def get_input
   puts "Enter Input: "
   input = $stdin.gets
-  input.strip.chomp == "" ? "null" : input
 end

 def get_gas
@@ -90,9 +89,22 @@ compiled_variable_name = "#{current_contract}Compiled"
 contract_variable_name = "#{current_contract}Contract"
 contract_instance_variable_name = "#{current_contract}"

-gas = get_gas
-value = get_value
-input = get_input
+if ARGV.length <= 1
+  gas = get_gas
+else
+  gas = ARGV[1].to_i
+end
+if ARGV.length <= 2
+  value = get_value
+else
+  value = ARGV[2].to_i
+end
+if ARGV.length <= 3
+  input = get_input
+else
+  input = ARGV[3]
+end
+input = input.strip.chomp == "" ? "null" : input

 File.open(javascript_file_name, 'w') do |f|
   f.write("#{library_code};\nvar #{compiled_variable_name} = #{compiled_object.to_json};")