Class: MyCommand
- Inherits:
-
Thor
- Object
- Thor
- MyCommand
- Defined in:
- bin/gomiko
Instance Method Summary collapse
- #empty(*ids) ⇒ Object
-
#ls(*ids) ⇒ Object
list.
-
#rm(*paths) ⇒ Object
option :dry_run, desc: “Dry run, not extcute.”, type: :boolean, default: false.
- #undo(*dirs) ⇒ Object
Instance Method Details
#empty(*ids) ⇒ Object
32 33 34 35 36 |
# File 'bin/gomiko', line 32 def empty(* ids) Gomiko.new.empty(ids: ids, mtime: [:mtime].to_i, verbose: ! [:quiet]) end |
#ls(*ids) ⇒ Object
list
59 |
# File 'bin/gomiko', line 59 desc :ls, 'Show trash directory' |
#rm(*paths) ⇒ Object
option :dry_run,
desc: "Dry run, not extcute.",
type: :boolean,
default: false
17 18 19 20 21 22 |
# File 'bin/gomiko', line 17 def rm(* paths) #paths.select do |path| # File.exist? path #end Gomiko.new.throw(paths: paths) end |
#undo(*dirs) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'bin/gomiko', line 39 def undo(* dirs) g = Gomiko.new if Dir.glob("#{@trashdir}/*").empty? puts "Nothing to undo in #{@trashdir}" exit end dirs = [g.list[-1]] if dirs.empty? dirs.each do |dir| begin g.undo(dir) rescue Errno::EACCES puts "Permission denined: #{dir}" end end end |