Class: OneCmd::Command::Macosx::HidenFiles

Inherits:
OneCmd::Command::Macosx show all
Defined in:
lib/onecmd/command/macosx/hiden_files.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OneCmd::Command

run

Constructor Details

#initialize(argv) ⇒ HidenFiles

Returns a new instance of HidenFiles.



15
16
17
18
# File 'lib/onecmd/command/macosx/hiden_files.rb', line 15

def initialize(argv)
  @hide = argv.flag?('hide', true)
  super
end

Class Method Details

.optionsObject



11
12
13
# File 'lib/onecmd/command/macosx/hiden_files.rb', line 11

def self.options
  [['--hide', 'hide system hiden files']].concat(super)
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
# File 'lib/onecmd/command/macosx/hiden_files.rb', line 20

def run
  if @hide
    system('defaults write com.apple.finder AppleShowAllFiles No && killall Finder')
  else
    system('defaults write com.apple.finder AppleShowAllFiles Yes && killall Finder')
  end
end