starscope 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +7 -1
- data/bin/starscope.rb +25 -14
- data/lib/starscope/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/bin/starscope.rb
CHANGED
@@ -11,30 +11,41 @@ DEFAULT_DB=".starscope.db"
|
|
11
11
|
|
12
12
|
# Options Parsing
|
13
13
|
OptionParser.new do |opts|
|
14
|
-
opts.banner =
|
14
|
+
opts.banner = <<END
|
15
|
+
Usage: starscope.rb [options] [PATHS]
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
end
|
17
|
+
If you don't pass any of -n, -r, -w or PATHS the default behaviour is to recurse
|
18
|
+
in the current directory and build or update the database `#{DEFAULT_DB}`.
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
end
|
20
|
+
Query scopes must be specified with `::`, for example -q calls,File::mtime.
|
21
|
+
END
|
23
22
|
|
24
|
-
opts.
|
23
|
+
opts.separator "\nQueries"
|
24
|
+
opts.on("-d", "--dump [TABLE]", "Dumps the DB or specified table to stdout") do |tbl|
|
25
|
+
options[:dump] = tbl || true
|
26
|
+
end
|
27
|
+
opts.on("-q", "--query TABLE,QUERY", "Looks up QUERY in TABLE") do |query|
|
25
28
|
options[:query] = query
|
26
29
|
end
|
30
|
+
opts.on("-s", "--summary", "Print a database summary to stdout") do
|
31
|
+
options[:summary] = true
|
32
|
+
end
|
27
33
|
|
28
|
-
opts.
|
34
|
+
opts.separator "\nDatabase Management"
|
35
|
+
opts.on("-n", "--no-auto", "Don't automatically update/create the database") do
|
36
|
+
options[:auto] = false
|
37
|
+
end
|
38
|
+
opts.on("-r", "--read-db READ", "Reads the DB from PATH instead of the default") do |path|
|
29
39
|
options[:read] = path
|
30
40
|
end
|
31
|
-
|
32
|
-
|
33
|
-
options[:summary] = true
|
41
|
+
opts.on("-w", "--write-db PATH", "Writes the DB to PATH instead of the default") do |path|
|
42
|
+
options[:write] = path
|
34
43
|
end
|
35
44
|
|
36
|
-
opts.
|
37
|
-
|
45
|
+
opts.separator "\nMisc"
|
46
|
+
opts.on("-v", "--version", "Print the version number") do
|
47
|
+
puts StarScope::VERSION
|
48
|
+
exit
|
38
49
|
end
|
39
50
|
|
40
51
|
end.parse!
|
data/lib/starscope/version.rb
CHANGED