summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2011-09-09 00:46:53 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2011-09-09 00:46:53 +0200
commitb91d633948be6c4b16ac44038ab4657442eb3982 (patch)
tree3cc0678fb88f80dab41033695203b751b7eaaf3d
parentc03fbba43089b79c9a12046e1409730c1a5fe28f (diff)
downloadcoderay-b91d633948be6c4b16ac44038ab4657442eb3982.tar.gz
executable: only the first arg can be subcommand, avoid map lookup
-rwxr-xr-xbin/coderay4
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'