summaryrefslogtreecommitdiffstats
path: root/philesight/philesight
diff options
context:
space:
mode:
Diffstat (limited to 'philesight/philesight')
-rwxr-xr-xphilesight/philesight62
1 files changed, 62 insertions, 0 deletions
diff --git a/philesight/philesight b/philesight/philesight
new file mode 100755
index 0000000..5ab0e09
--- /dev/null
+++ b/philesight/philesight
@@ -0,0 +1,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
+#