From b91d633948be6c4b16ac44038ab4657442eb3982 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Fri, 9 Sep 2011 00:46:53 +0200 Subject: executable: only the first arg can be subcommand, avoid map lookup --- bin/coderay | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/coderay') 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' -- cgit v1.2.1