bin/h in h-2.2.2 vs bin/h in h-3.0.0
- old
+ new
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
-require_relative File.join '..', 'lib', 'h'
+require_relative File.join('..', 'lib', 'h')
CONF_PATH = File.join(File.expand_path('~'), '.h')
unless File.exist?(CONF_PATH)
print "Creating #{CONF_PATH} file... "
@@ -14,12 +14,14 @@
File.chmod(0600, CONF_PATH)
puts 'Done.'
end
-h = H::Generator.new(File.open(CONF_PATH).readlines.first.chomp)
+secret = File.open(CONF_PATH)
+ .readlines
+ .fetch(0)
+ .chomp
-puts h.input ARGV[0].to_s, if ARGV[1].nil?
- 44
- else
- ARGV[1].to_i
- end
+builder = H::Builder.new(secret)
+result = builder.call(ARGV[0])
+
+puts result