sshfs-mapper config: Added default action.

git-svn-id: https://websvn.glenux.net/svn/Upoc/sshfs-mapper/trunk@1665 eaee96b3-f302-0410-b096-c6cfd47f7835
This commit is contained in:
glenux 2011-03-15 16:57:02 +00:00
parent f714f688ab
commit 37707ab9da

View file

@ -14,13 +14,13 @@ module SshfsMapper
attr_reader :maps_active attr_reader :maps_active
attr_reader :maps attr_reader :maps
attr_reader :action
ACTION_UMOUNT = :umount ACTION_UMOUNT = :umount
ACTION_MOUNT = :mount ACTION_MOUNT = :mount
ACTION_INIT = :init ACTION_INIT = :init
def initialize def initialize
@action = ACTION_MOUNT
user = if ENV['USER'] then user = if ENV['USER'] then
ENV['USER'] ENV['USER']
@ -40,6 +40,7 @@ module SshfsMapper
home_dir + '/.config' home_dir + '/.config'
end end
@action = ACTION_MOUNT
@config_dir = xdg_dir + '/sshfs-mapper' @config_dir = xdg_dir + '/sshfs-mapper'
@config_file = nil @config_file = nil
@maps = [] @maps = []
@ -53,7 +54,7 @@ module SshfsMapper
def parse_file &blk def parse_file &blk
rdebug "Config: #{@config_dir}/config" rdebug "Config: #{@config_dir}/config"
maps = [] @maps = []
Find.find( @config_dir ) do |path| Find.find( @config_dir ) do |path|
if File.file? path if File.file? path
if File.basename( path ) =~ /.map$/ if File.basename( path ) =~ /.map$/
@ -68,7 +69,6 @@ module SshfsMapper
#total_size += FileTest.size(path) #total_size += FileTest.size(path)
end end
end end
return maps
end end
def parse_cmd_line args def parse_cmd_line args