Class: MyCommand

Inherits:
Thor
  • Object
show all
Defined in:
bin/gomiko

Instance Method Summary collapse

Instance Method Details

#empty(*ids) ⇒ Object



28
29
30
31
32
# File 'bin/gomiko', line 28

def empty(* ids)
  Gomiko.new.empty(ids: ids,
                   mtime: options[:mtime].to_i,
                   verbose: ! options[:quiet])
end

#ls(*ids) ⇒ Object

list



54
# File 'bin/gomiko', line 54

desc :ls, 'Show trash directory'

#rm(*paths) ⇒ Object

option :dry_run,

desc: "Dry run, not extcute.",
type: :boolean,
default: false


17
18
19
# File 'bin/gomiko', line 17

def rm(* paths)
  Gomiko.new.throw(paths: paths)
end

#undo(*dirs) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'bin/gomiko', line 35

def undo(* dirs)
  g = Gomiko.new

  if g.dir_list.empty?
    puts "Nothing to undo in #{g.trashdir}"
    exit
  end

  dirs = [g.dir_list[-1]] if dirs.empty?
  dirs.each do |dir|
    begin
      g.undo(dir)
    rescue Errno::EACCES
      puts "Permission denined: #{dir}"
    end
  end
end