example_command_line.rb
Basic command line handling for most examples.
00001 #!/usr/bin/env ruby 00002 # vim: set sw=4 sts=4 et tw=80 : 00003 00004 =begin description 00005 Basic command line handling for most examples. 00006 =end 00007 00008 require 'getoptlong' 00009 require 'singleton' 00010 require 'Paludis' 00011 00012 class ExampleCommandLine < GetoptLong 00013 include Singleton 00014 00015 def initialize 00016 super( 00017 [ '--log-level', GetoptLong::REQUIRED_ARGUMENT ], 00018 [ '--environment', '-E', GetoptLong::REQUIRED_ARGUMENT ] 00019 ) 00020 00021 @environment = "" 00022 each do | opt, arg | 00023 case opt 00024 when '--log-level' 00025 Paludis::Log.instance.log_level = Paludis::LogLevel::Debug 00026 when '--environment' 00027 @environment = arg 00028 end 00029 end 00030 end 00031 00032 attr_reader :environment 00033 end 00034
