#!  /usr/bin/env python
import sys
import time

import abjad

abjad. IOManager.spawn_subprocess("clear")
start_time = time.time()
argument = sys.argv[1]

command = r"ack"
command += r" --ignore-dir=.mypy_cache"
command += r" --ignore-dir=.mypy_cache"
command += r" --ignore-dir=_docs"
command += r" --ignore-dir=build"
command += r" --ignore-dir=docs"
command += r" --ignore-dir=htmlcov"
command += r" --ignore-file=ext:eps"
command += r" --ignore-file=is:.coverage"
command += r" --sort-files"
if "'" in argument:
    command += rf' "{argument}"'
else:
    command += rf" '{argument}'"
print("abjad-ack is running this command:")
print()
print("    " + command)
print()

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

print()
counter = abjad. String.pluralize("second", total_time)
print(f"abjad-ack total time {total_time} {counter}.") 
print()
