diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2011-09-09 00:46:53 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2011-09-09 00:46:53 +0200 |
commit | b91d633948be6c4b16ac44038ab4657442eb3982 (patch) | |
tree | 3cc0678fb88f80dab41033695203b751b7eaaf3d /bin/coderay | |
parent | c03fbba43089b79c9a12046e1409730c1a5fe28f (diff) | |
download | coderay-b91d633948be6c4b16ac44038ab4657442eb3982.tar.gz |
executable: only the first arg can be subcommand, avoid map lookup
Diffstat (limited to 'bin/coderay')
-rwxr-xr-x | bin/coderay | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/coderay b/bin/coderay index acb05ed..0dc42b7 100755 --- a/bin/coderay +++ b/bin/coderay @@ -2,7 +2,7 @@ require 'coderay' $options, args = ARGV.partition { |arg| arg[/^-[hv]$|--\w+/] } -subcommand = args.detect { |arg| arg[/^\w/] } +subcommand = args.first if /^\w/ === args.first subcommand = nil if subcommand && File.exist?(subcommand) args.delete subcommand @@ -105,7 +105,7 @@ when 'highlight', nil if output_file output_filetype ||= CodeRay::FileType[output_file] else - output_filetype ||= :term + output_filetype ||= :terminal end output_filetype = :page if output_filetype.to_s == 'html' |