scm: Add command line options to specify path if we want.

Also add a dummy --commit which we pass from Edi for future requirements
This commit is contained in:
Andy Williams 2017-12-30 19:01:08 +00:00
parent 611c68175f
commit 71351c1c60
1 changed files with 44 additions and 2 deletions

View File

@ -50,11 +50,53 @@ int main(int argc, char **argv)
{
Evas_Object *win;
Edi_Scm_Engine *engine;
const char *arg, *root;
ecore_init();
elm_init(argc, argv);
if (!edi_scm_init())
exit(1 << 0);
root = NULL;
if (argc >= 2)
{
arg = argv[1];
if (!strcmp("-h", arg) || !strcmp("--help", arg))
{
printf("Usage: edi_scm [directory]\n\n");
printf("The Enlightened IDE Source Control\n\n");
printf("Options:\n");
printf(" -c, --commit\t\topen with the commit screen.\n");
printf(" -h, --help\t\tshow this message.\n");
return 0;
}
if (!strcmp("-c", arg) || !strcmp("--commit", arg))
{
if (argc >= 3)
root = argv[2];
}
else
{
root = arg;
}
}
if (root)
{
if (!ecore_file_is_dir(root))
{
fprintf(stderr, _("Root path must be a directory\n"));
exit(1 << 0);
}
engine = edi_scm_init_path(realpath(root, NULL));
}
else
{
engine = edi_scm_init();
}
if (!engine)
exit(1 << 2);
win = _win_add(engine);
edi_scm_ui_add(win);