summary refs log tree commit diff stats
path: root/code/action.rb
diff options
context:
space:
mode:
Diffstat (limited to 'code/action.rb')
-rw-r--r--code/action.rb55
1 files changed, 35 insertions, 20 deletions
diff --git a/code/action.rb b/code/action.rb
index e463e852..34a07242 100644
--- a/code/action.rb
+++ b/code/action.rb
@@ -1,44 +1,54 @@
 module Action
-	def self.copy(files, path)
+	extend self
+
+	def close_interface
+		closei
+	end
+
+	def start_interface
+		starti
+	end
+
+	def copy(files, path)
 		files = [files] unless files.is_a? Array
 		unless files.empty?
 			CopyBar2.new(files, path)
 		end
 	end
 
-	def self.move(files, path)
+	def move(files, path)
 		files = [files] unless files.is_a? Array
 		unless files.empty?
 			MoveBar2.new(files, path)
 		end
 	end
 
-	def self.run(hash = {})
-		unless OpenStruct === hash
-			hash = OpenStruct.new(hash)
-		end
+	def run(rc = nil)
+		rc ||= RunContext.new(Fm.getfiles)
+		assert rc, RunContext
 
 		cf       = Fm.currentfile
 		
-		all      = hash.all.or true
-		files    = hash.files.or(all ? Fm.selection : [cf])
-		mode     = hash.mode.or 0
-		newway   = hash.newway.or false
+		all      = rc.all.or true
+		files    = rc.files.or(all ? Fm.selection : [cf])
+		mode     = rc.mode.or 0
+		newway   = rc.newway.or false
 
 		return false if files.nil?
 
 		if newway
-			hash = Fm.filehandler(files, hash)
-			handler = hash.exec
+#			logpp files.first.handler
+#			rc = Fm.filehandler(files, struct)
+			handler = rc.exec
 		else
 			handler, wait = Fm.getfilehandler(*files)
 		end
 
 		return false unless handler
 
-		wait     = hash.wait.or wait
-		new_term = hash.new_term.or false
-		detach   = hash.detach.or false
+		wait     = rc.wait.or wait
+		new_term = rc.new_term.or false
+		detach   = rc.detach.or false
 
 		log handler
 		if detach
@@ -49,7 +59,7 @@ module Action
 		return true
 	end
 
-	def self.run_detached(what, new_term)
+	def run_detached(what, new_term)
 		if new_term
 			p = fork { exec('x-terminal-emulator', '-e', 'bash', '-c', what) }
 #			Process.detach(p)
@@ -59,11 +69,16 @@ module Action
 		end
 	end
 
-	def self.run_inside(what, wait)
-		closei
+	def run_inside(what, wait)
+		close_interface
 		system(*what)
-		gets if wait
-		starti
+		wait_for_enter if wait
+		start_interface
+	end
+
+	def wait_for_enter
+		print "Press [ENTER] to continue..."
+		gets
 	end
 end