38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/bitclust/runner.rb', line 38
def prepare
@prefix = nil
@version = nil
@capi = false
@parser = OptionParser.new
@parser.banner = <<-EndBanner
Usage: #{File.basename($0, '.*')} [global options] <subcommand> [options] [args]
Subcommands(for users):
init Initialize database.
update Update database.
setup Initialize and update database with default options.
list List libraries/classes/methods in database.
lookup Lookup a library/class/method from database.
search Search classes/methods from database.
Subcommands(for developers):
ancestors Compare class/module's ancestors between Ruby and DB.
htmlfile Generate a static HTML file for test.
query Dispatch arbitrary query.
property Handle database properties.
preproc Preprocess source file.
extract Extract method entries from source file.
classes Display defined classes for all ruby.
methods Display defined methods for all ruby.
Subcommands(for packagers):
statichtml Generate static HTML files.
epub Generate EPUB file.
chm Generate static HTML files for CHM.
Global Options:
EndBanner
@parser.on('-d', '--database=PATH', 'Database prefix.') {|path|
@prefix = path
}
@parser.on('-t', '--target=VERSION', 'Specify Ruby version.') {|v|
@version = v
}
@parser.on('--capi', 'Process C API database.') {
@capi = true
}
@parser.on('--version', 'Print version and quit.') {
puts BitClust::VERSION
exit 0
}
@parser.on('--help', 'Prints this message and quit.') {
puts @parser.help
exit 0
}
@subcommands = {
'init' => BitClust::Subcommands::InitCommand.new,
'list' => BitClust::Subcommands::ListCommand.new,
'lookup' => BitClust::Subcommands::LookupCommand.new,
'search' => BitClust::Searcher.new,
'query' => BitClust::Subcommands::QueryCommand.new,
'update' => BitClust::Subcommands::UpdateCommand.new,
'property' => BitClust::Subcommands::PropertyCommand.new,
'setup' => BitClust::Subcommands::SetupCommand.new,
'server' => BitClust::Subcommands::ServerCommand.new,
'statichtml' => BitClust::Subcommands::StatichtmlCommand.new,
'htmlfile' => BitClust::Subcommands::HtmlfileCommand.new,
'chm' => BitClust::Subcommands::ChmCommand.new,
'epub' => BitClust::Subcommands::EPUBCommand.new,
'ancestors' => BitClust::Subcommands::AncestorsCommand.new,
'preproc' => BitClust::Subcommands::PreprocCommand.new,
'extract' => BitClust::Subcommands::ExtractCommand.new,
'classes' => BitClust::Subcommands::ClassesCommand.new,
'methods' => BitClust::Subcommands::MethodsCommand.new,
}
end
|