bin/hoc in hoc-0.4.2 vs bin/hoc in hoc-0.5
- old
+ new
@@ -26,20 +26,36 @@
require 'hoc'
require 'slop'
require 'hoc/version'
-opts = Slop.parse(ARGV, strict: true, help: true) do
+args = []
+args.push(*File.read('.hoc').split(/\s+/).map(&:strip)) if File.exist?('.hoc')
+args.push(*ARGV)
+
+opts = Slop.parse(args, strict: true, help: true) do
banner "Usage (#{HOC::VERSION}): hoc [options]"
- on 'f', 'format', 'Output format (text|xml|json|int)',
- default: 'int', argument: :required
+ on(
+ 'f',
+ 'format',
+ 'Output format (text|xml|json|int)',
+ default: 'int',
+ argument: :required
+ )
+ on(
+ 'e',
+ 'exclude',
+ 'Glob pattern to exclude files/dirs, e.g. "vendor/**"',
+ as: Array,
+ argument: :required
+ )
end
if opts.help?
puts opts
exit
end
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
-puts HOC::Base.new(Dir.pwd, opts[:format]).report
+puts HOC::Base.new(Dir.pwd, opts).report