Sha256: 459a209b447e75fd8519fd22e69c8a8863f38d742cb9ee6254de8284eefa98f4

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

#!/usr/bin/ruby

$arg = ARGV.first
$val = ARGV[1]

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

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

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

case $arg
when 'hide', 'h', '--hide', '-h'
  hide()
when 'show', 's', '--show', '-s'
  show()
when 'help', '--help', 'usage', '--usage', nil
  help()
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
antonio-1.0.0 lib/antonio.rb