24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/bloggit/commandline.rb', line 24
def execute
cmd = CmdParse::CommandParser.new( true, true )
Bloggit::Cmdline.verbose = false
cmd.program_name = "bloggit"
cmd.program_version = Bloggit::RELEASE_INFO
cmd.options = CmdParse::OptionParserWrapper.new do |opt|
opt.separator "Global options:"
opt.on("--verbose", "Be verbose when outputting info") {|t| Bloggit::Cmdline.verbose = true }
end
puts "Loading commands from #{File.join( File.dirname(__FILE__), 'commands', '*.rb')} (#{Bloggit::Cmdline.verbose})"
Dir[ File.join( File.dirname(__FILE__), 'commands', '*.rb') ].each do |command|
require command
end
site = Dir.getwd.ends_with?('.blog') ? Bloggit::Site.from_file(Dir.getwd) : nil
Cmdline.build( cmd, site )
cmd.add_command( CmdParse::HelpCommand.new )
cmd.add_command( CmdParse::VersionCommand.new )
cmd.parse
end
|