Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#helpObject



34
35
36
37
38
39
40
41
42
# File 'lib/antonio.rb', line 34

def help
  puts "\nUse Antonio to hide/show files and directories.\n\n"
  puts "  hide or h: Hides the following file."
  puts "  (Usage: antonio hide secret-file.txt)\n\n"
  puts "  show or s: Shows the following file."
  puts "  (Usage: antonio show .secret-file.txt)\n\n"
  puts "  help: Shows this help screen."
  puts "  (Usage: antonio help)\n\n"
end

#hideObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/antonio.rb', line 6

def hide
  if $val.nil?
    puts "Dude, you need to tell me what to hide."
  elsif $val[0..0] == "."
    puts "Please try to hide a shown file."
  else
    if File.exist? $val
      File.rename($val, "." << $val )
    else
      puts "That's not a valid file. Try again."
    end
  end
end

#showObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/antonio.rb', line 20

def show
  if $val.nil?
    puts "Dude, you need to tell me what to show."
  elsif $val[0..0] != "."
    puts "Please try to show a hidden file."
  else
    if File.exist? $val
      File.rename($val, $val[1..-1])
    else
      puts "That's not a valid file. Try again."
    end
  end
end