summaryrefslogtreecommitdiffstats
path: root/philesight/philesight
blob: 5ab0e09731063c073addbada9ad6678227a69923 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/ruby
# vi: ts=2 sw=2

require 'getoptlong'
require 'philesight'

opts = GetoptLong.new(
  [ "--index", "-i",            GetoptLong::REQUIRED_ARGUMENT ],
  [ "--draw",	 "-d",            GetoptLong::REQUIRED_ARGUMENT ],
  [ "--path",	 "-p",            GetoptLong::REQUIRED_ARGUMENT ],
  [ "--db",    "-D",            GetoptLong::REQUIRED_ARGUMENT ],
  [ "--dump",	 "-u",            GetoptLong::NO_ARGUMENT       ],
	[ "--help",  "-h",						GetoptLong::NO_ARGUMENT       ]
)

def usage
	puts
	puts "usage: philesight <options>"
	puts
	puts "Options:"
	puts "  --db <db>        Set path to database file"
	puts "  --path <path>    Path to show in generated image"
	puts "  --index <path>   Top-level directory to start indexing"
	puts "  --dump           Dump database to readable format"
	puts
	puts "Examples:"
	puts "  Index to database:   philesight --db <db> --index <path>"
	puts "  Generate PNG:        philesight --db <db> --path <path> --draw <png>"
	puts
end


t = Philesight.new
path = ""

opts.each do |opt, arg|

	case opt
		when "--draw"
			t.draw(path, arg)

		when "--index"
			t.readdir(arg)

		when "--path"
			path = arg

		when "--db"
			t.db_open(arg)

		when "--dump"
			t.dump

		else
			usage

	end
end

# 
# End
#