[BioRuby-cvs] bioruby/lib/bio/shell interface.rb,1.13,1.14
Katayama Toshiaki
k at pub.open-bio.org
Mon Feb 27 09:36:37 UTC 2006
Update of /home/repository/bioruby/bioruby/lib/bio/shell
In directory pub.open-bio.org:/tmp/cvs-serv1071/lib/bio/shell
Modified Files:
interface.rb
Log Message:
* 'less' command is removed and merged into 'disp' command
Index: interface.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/interface.rb,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** interface.rb 17 Feb 2006 17:11:59 -0000 1.13
--- interface.rb 27 Feb 2006 09:36:35 -0000 1.14
***************
*** 20,23 ****
--- 20,24 ----
}
puts list.inspect
+ return list
end
***************
*** 71,74 ****
--- 72,77 ----
when :message, "message"
Bio::Shell.config_message(*opts)
+ else
+ puts "Invalid mode (#{mode}) - :show, :echo, :color, :splash, :massage"
end
end
***************
*** 82,86 ****
def pager(cmd = nil)
unless Bio::Shell.config[:pager]
! cmd = ENV['PAGER'] || cmd
end
Bio::Shell.config_pager(cmd)
--- 85,89 ----
def pager(cmd = nil)
unless Bio::Shell.config[:pager]
! cmd ||= ENV['PAGER']
end
Bio::Shell.config_pager(cmd)
***************
*** 88,99 ****
end
! def disp(*obj)
# The original idea is from http://sheepman.parfait.ne.jp/20050215.html
! if Bio::Shell.config[:pager]
! pg = IO.popen(Bio::Shell.config[:pager], "w")
begin
stdout_save = STDOUT.clone
STDOUT.reopen(pg)
! puts(*obj)
ensure
STDOUT.reopen(stdout_save)
--- 91,112 ----
end
! def disp(*objs)
# The original idea is from http://sheepman.parfait.ne.jp/20050215.html
! if cmd = Bio::Shell.config[:pager]
! pg = IO.popen(cmd, "w")
begin
stdout_save = STDOUT.clone
STDOUT.reopen(pg)
! objs.each do |obj|
! if obj.is_a?(String)
! if File.exists?(obj)
! system("#{cmd} #{obj}")
! else
! obj.display
! end
! else
! pp obj
! end
! end
ensure
STDOUT.reopen(stdout_save)
***************
*** 102,115 ****
end
else
! # or use Object#display ?
! puts(*obj)
end
end
- def less(file)
- pager = Bio::Shell.config[:pager] || ENV['PAGER'] || "less"
- system("#{pager} #{file}")
- end
-
def head(arg, num = 10)
str = ""
--- 115,128 ----
end
else
! objs.each do |obj|
! if obj.is_a?(String)
! obj.display
! else
! pp obj
! end
! end
end
end
def head(arg, num = 10)
str = ""
***************
*** 136,145 ****
def savefile(file, *objs)
datadir = Bio::Shell.datadir
! message = "Save file '#{file}' in '#{datadir}' directory? [y/n]: "
if ! file[/^#{datadir}/] and Bio::Shell.ask_yes_or_no(message)
file = datadir + file
end
if File.exists?(file)
! message = "Overwrite existing '#{file}' file? [y/n]: "
if ! Bio::Shell.ask_yes_or_no(message)
puts " ... save aborted."
--- 149,158 ----
def savefile(file, *objs)
datadir = Bio::Shell.datadir
! message = "Save file '#{file}' in '#{datadir}' directory? [y/n] "
if ! file[/^#{datadir}/] and Bio::Shell.ask_yes_or_no(message)
file = datadir + file
end
if File.exists?(file)
! message = "Overwrite existing '#{file}' file? [y/n] "
if ! Bio::Shell.ask_yes_or_no(message)
puts " ... save aborted."
More information about the bioruby-cvs
mailing list