configs: decide later (ignore this file for this session)

This commit is contained in:
Denis Knauf 2015-02-16 13:31:00 +01:00
parent 1f874aaf69
commit b1ca5f029e

View file

@ -216,12 +216,13 @@ end
class UI class UI
attr_accessor :need_to_print attr_accessor :need_to_print
attr_reader :selected, :cmds, :list, :found, :dirs attr_reader :selected, :cmds, :list, :found, :dirs, :ignore_list
def selected= x def selected= x
@selected, @need_to_print = x, !!x @selected, @need_to_print = x, !!x
end end
def initialize cmds, dirs def initialize cmds, dirs
@ignore_list = []
@cmds, @dirs = cmds, dirs @cmds, @dirs = cmds, dirs
end end
@ -230,7 +231,9 @@ class UI
@found = Hash.new {|h,k| h[k] = [] } @found = Hash.new {|h,k| h[k] = [] }
@list = {} @list = {}
find_cfgs( dirs).each do |cfg| find_cfgs( dirs).each do |cfg|
found[cfg.dirname + cfg.basename.to_s.sub( /^\._cfg...._/, '')] += [cfg] conf = cfg.dirname + cfg.basename.to_s.sub( /^\._cfg...._/, '')
next if ignore_list.include? conf
found[conf] += [cfg]
end end
if found.empty? if found.empty?
puts "No files to update." puts "No files to update."
@ -332,6 +335,14 @@ cmds = Commands.new do
selected = nil selected = nil
end end
help 'Ignore selected file for this session (do not anything with this file)'
on %w[\later \ignore] do
raise NoSelection unless selected
ignore_list.push selected
self.need_to_print = false
self.selected = nil
end
help 'Quit' help 'Quit'
on %w[\quit \exit] do on %w[\quit \exit] do
exit 0 exit 0