sshfs-mapper: dispatch command line options.

git-svn-id: https://websvn.glenux.net/svn/Upoc/sshfs-mapper/trunk@1663 eaee96b3-f302-0410-b096-c6cfd47f7835
This commit is contained in:
glenux 2011-03-10 16:56:54 +00:00
parent ab551dfc92
commit e92726d683

View file

@ -9,25 +9,58 @@ require 'sshfs-mapper/config'
require 'sshfs-mapper/map' require 'sshfs-mapper/map'
module SshfsMapper module SshfsMapper
class SshfsMapper class SshfsMapper
#
#
#
def initialize def initialize
@all_maps = nil
@active_maps = nil @active_maps = nil
puts "-- sshfs-mapper --" puts "-- sshfs-mapper --"
conf = Config.new conf = Config.new
conf.parse_cmd_line ARGV conf.parse_cmd_line ARGV
@active_maps = conf.parse_file @all_maps = conf.parse_file
puts conf puts conf
end end
def run # create default map for each selected map
if @active_maps.nil? then # or default.map if none selected
return def run_init
end end
@active_maps.each do |map|
def run_mount
selected_maps = if @config.all_maps @all_maps
@all_maps.each do |map|
pp map pp map
#map.connect() # if map.available? then
# map.connect!
# end
end end
end
def run_umount
end
#
#
#
def run
case @config.action
when Config::ACTION_INIT
run_init
when Config::ACTION_MOUNT
run_mount
when Config::ACTION_UMOUNT
run_umount
else
raise RuntimeError, "Unknown action"
end
puts "--run" puts "--run"
end end