Add --no-import option
This commit is contained in:
parent
adb035bbc3
commit
32c06824fb
11
wp2git.d
11
wp2git.d
|
@ -12,7 +12,7 @@ import litexml;
|
||||||
int main(string[] args)
|
int main(string[] args)
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
bool usage;
|
bool usage, noImport;
|
||||||
foreach (arg; args[1..$])
|
foreach (arg; args[1..$])
|
||||||
switch (arg)
|
switch (arg)
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,9 @@ int main(string[] args)
|
||||||
case "--help":
|
case "--help":
|
||||||
usage = true;
|
usage = true;
|
||||||
break;
|
break;
|
||||||
|
case "--no-import":
|
||||||
|
noImport = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (name)
|
if (name)
|
||||||
throw new Exception("Multiple article name arguments");
|
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, "Create a git repository with the history of the specified Wikipedia article.");
|
||||||
fwritefln(stderr, "Supported options:");
|
fwritefln(stderr, "Supported options:");
|
||||||
fwritefln(stderr, " -h --help Display this help");
|
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;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,12 +80,15 @@ int main(string[] args)
|
||||||
}
|
}
|
||||||
write("fast-import-data", data);
|
write("fast-import-data", data);
|
||||||
|
|
||||||
|
if (noImport)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (exists(".git"))
|
if (exists(".git"))
|
||||||
throw new Exception("A git repository already exists here!");
|
throw new Exception("A git repository already exists here!");
|
||||||
|
|
||||||
system("git init");
|
system("git init");
|
||||||
system("git fast-import --date-format=rfc2822 < fast-import-data");
|
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");
|
system("git reset --hard");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue