parser.add_argument('package', nargs='?', default='all')
parser.add_argument('residuals', nargs='*', default=[])
parser.add_argument('command')
parser.add_argument('-h', '--help', action='store_true')
args = parser.parse_args()

if len(args.residuals) > 0 or args.help:
    io.println(io.Yellow("usage:"), args.package, "status [-h]")
    io.exitFail()

io.printAsync(io.Empty(), "checking package..", io.Progress())
if not pkg.packageIsDir(args.package):
    io.println(io.Fail(), args.package, "does not exist")
    io.exitFail()

if not pkg.packageIsGitRepository(args.package):
    io.println(io.Fail(), args.package, "is not a git repository")
    io.exitFail()

repo = pkg.getPackageRepo(args.package)

package_clear = True

io.printAsync(io.Empty(), "checking untracked files in", args.package, "\b..",
              io.Progress())
untracked_files = repo.untracked_files
if len(untracked_files) > 0:
    package_clear = False
    io.println(io.Warn(), "found", len(untracked_files), "untracked files:")
    for untracked_file in untracked_files:
        io.println(io.WarnList(), untracked_file)
if args.package != 'all' or len(args.residuals) > 0 or args.help:
    io.println(io.Yellow("usage:"), "kuro status [-h]")
    io.exitFail()

all_clear = True

for package in pkg.packages:

    io.printAsync(io.Empty(), "checking package..", io.Progress())
    if not pkg.packageIsDir(package):
        io.println(io.Fail(), package, "does not exist")
        all_clear = False
        continue

    if not pkg.packageIsGitRepository(package):
        io.println(io.Fail(), package, "is not a git repository")
        all_clear = False
        continue

    repo = pkg.getPackageRepo(package)

    package_clear = True

    io.printAsync(io.Empty(), "checking untracked files in", package, "\b..",
                  io.Progress())
    untracked_files = repo.untracked_files
    if len(untracked_files) > 0:
        all_clear = False
        if package_clear:
            io.println(io.Warn(), package, "({})".format(repo.active_branch),