#! /usr/bin/env python
import sys
import time
from abjad.tools import systemtools


systemtools.IOManager.clear_terminal()
start_time = time.time()
argument = sys.argv[1]
if "'" in argument:
    command = r'ack --ignore-dir=docs --ignore-dir=build "{}"'
else:
    command = r"ack --ignore-dir=docs --ignore-dir=build '{}'"
command = command.format(argument)
print 'abjad-ack is running this command:'
print
print '    ' + command
print

systemtools.IOManager.spawn_subprocess(command)
stop_time = time.time()
total_time = stop_time - start_time

print
print 'abjad-ack total time: {} second(s).'.format(int(total_time))
print
