#!/usr/bin/env python

import sys, os

if len(sys.argv) != 2: 
    print "Usage:  showhide true/false"
    exit(0)

if sys.argv[1] not in ["true", "false"]:
    print "Usage:  showhide true/false"
    exit(0)

cmd = "defaults write com.apple.finder AppleShowAllFiles -boolean %s; killall Finder" % sys.argv[1]

ret = os.popen(cmd).readlines()
if len(ret) == 0:
    ret.append("sucess")
for line in ret:
    print line
