lib/js_dependency/cli.rb in js_dependency-0.3.3.1 vs lib/js_dependency/cli.rb in js_dependency-0.3.4

- old
+ new

@@ -63,11 +63,11 @@ src_path = options[:src_path] || args["src_path"] target_path = options[:target_path] || args["target_path"] parent_analyze_level = options[:parent_analyze_level] || args["parent_analyze_level"] || 1 output_path = options[:output_path] || args["output_path"] || nil alias_paths = args["alias_paths"] || nil - excludes = if options[:excludes].length.positive? + excludes = if options[:excludes]&.length&.positive? options[:excludes] elsif args["excludes"] args["excludes"] end @@ -98,11 +98,11 @@ src_path = options[:src_path] || args["src_path"] target_path = options[:target_path] || args["target_path"] child_analyze_level = options[:child_analyze_level] || args["child_analyze_level"] || 1 output_path = options[:output_path] || args["output_path"] || nil alias_paths = args["alias_paths"] || nil - excludes = if options[:excludes].length.positive? + excludes = if options[:excludes]&.length&.positive? options[:excludes] elsif args["excludes"] args["excludes"] end @@ -114,8 +114,13 @@ alias_paths: alias_paths, excludes: excludes ).join("\n") puts str + end + + desc "version", "show version" + def version + puts JsDependency::VERSION end end end