Add --no-import option

This commit is contained in:
Vladimir Panteleev 2010-09-13 01:27:35 +03:00
parent adb035bbc3
commit 32c06824fb
1 changed files with 9 additions and 2 deletions

View File

@ -12,7 +12,7 @@ import litexml;
int main(string[] args)
{
string name;
bool usage;
bool usage, noImport;
foreach (arg; args[1..$])
switch (arg)
{
@ -20,6 +20,9 @@ int main(string[] args)
case "--help":
usage = true;
break;
case "--no-import":
noImport = true;
break;
default:
if (name)
throw new Exception("Multiple article name arguments");
@ -33,6 +36,7 @@ int main(string[] args)
fwritefln(stderr, "Create a git repository with the history of the specified Wikipedia article.");
fwritefln(stderr, "Supported options:");
fwritefln(stderr, " -h --help Display this help");
fwritefln(stderr, " --no-import Don't invoke ``git fast-import'' and only generate the fast-import data");
return 2;
}
@ -76,12 +80,15 @@ int main(string[] args)
}
write("fast-import-data", data);
if (noImport)
return 0;
if (exists(".git"))
throw new Exception("A git repository already exists here!");
system("git init");
system("git fast-import --date-format=rfc2822 < fast-import-data");
// std.file.remove("fast-import-data");
std.file.remove("fast-import-data");
system("git reset --hard");
return 0;