#!/usr/bin/env perl
use strict;
use warnings;
use 5.014;

use Getopt::Long qw(:config gnu_getopt);
use App::Multigit;
use Path::Class;

my $workdir;
GetOptions(
    'help|h' => sub {
        say usage();
        exit 0;
    },
    'workdir=s' => \$workdir,
);

say App::Multigit::mg_parent(dir($workdir));

sub usage() {
<<EOU
Usage:
    
    mg root

Reports the closest parent directory with a .mgconfig file in it.
EOU
}
