Skip to content

Commit

Permalink
Accept wildcards in mjai convert.
Browse files Browse the repository at this point in the history
  • Loading branch information
gimite committed Aug 22, 2015
1 parent 6860ac8 commit a79c904
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/mjai/mjai_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ def self.execute(command_name, argv)
when "convert"
conv = FileConverter.new()
if opts["output_type"]
for path in argv
conv.convert(path, "%s.%s" % [path, opts["output_type"]])
for pattern in argv
paths = Dir[pattern]
if paths.empty?
$stderr.puts("No match: %s" % pattern)
exit(1)
end
for path in paths
conv.convert(path, "%s.%s" % [path, opts["output_type"]])
end
end
else
conv.convert(argv.shift(), argv.shift())
Expand Down

0 comments on commit a79c904

Please sign in to comment.