From 168e1a1ee9f697aac699bf52ac779d9a30ca1bf0 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 20 Jul 2009 05:07:13 +0200 Subject: added comments --- ranger | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/ranger b/ranger index cc95c619..645ea114 100755 --- a/ranger +++ b/ranger @@ -1,6 +1,6 @@ #!/usr/bin/ruby -Ku ##-------------------------------------------------- -# Ignore the following lines +# just ignore the following lines if false; then =begin @@ -8,11 +8,17 @@ fi; cd "`ranger --cd $@ 3>&1 1>&2`"; return =end end +##-------------------------------------------------- +# Ranger + version = '0.2.4' require 'pathname' $: << MYDIR = File.dirname(Pathname(__FILE__).realpath) +##-------------------------------------------------- +# parse arguments + ARGV.delete('--cd') if cd = ARGV.include?('--cd') if ARGV.size > 0 case ARGV.first @@ -32,11 +38,16 @@ else pwd = nil end +##-------------------------------------------------- +# require files + for file in Dir.glob "#{MYDIR}/code/**/*.rb" require file [MYDIR.size + 1 ... -3] end -## default options +##-------------------------------------------------- +# default options + opt = { :show_hidden => false, :sort => :name, @@ -58,6 +69,9 @@ opt = { :evil => false } +##-------------------------------------------------- +# initialization + class OptionClass < Struct.new(*opt.keys) def confirm_string; confirm ? super : "" end end @@ -91,6 +105,9 @@ end CLI.init_mouse( Option.mouse_interval ) +##-------------------------------------------------- +# run the shit & clean up afterwards + begin Fm.initialize( pwd ) Fm.main_loop -- cgit 1.4.1-2-gfad0