Output messages and progress to stderr
This commit is contained in:
parent
5d1e2e20e5
commit
be2da029c6
4
wp2git.d
4
wp2git.d
|
@ -9,7 +9,7 @@ int main(string[] args)
|
||||||
{
|
{
|
||||||
if (args.length != 2)
|
if (args.length != 2)
|
||||||
{
|
{
|
||||||
writefln("Usage: %s Article_name", args[0]);
|
fwritefln(stderr, "Usage: %s Article_name", args[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,12 +20,14 @@ int main(string[] args)
|
||||||
if (spawnvp(P_WAIT, "curl", ["curl", "-d", "\"\"", "http://en.wikipedia.org/w/index.php?title=Special:Export&pages=" ~ name, "-o", "history.xml"]))
|
if (spawnvp(P_WAIT, "curl", ["curl", "-d", "\"\"", "http://en.wikipedia.org/w/index.php?title=Special:Export&pages=" ~ name, "-o", "history.xml"]))
|
||||||
throw new Exception("curl error");
|
throw new Exception("curl error");
|
||||||
|
|
||||||
|
fwritefln(stderr, "Loading history...");
|
||||||
auto xml = new XmlDocument(new File("history.xml"));
|
auto xml = new XmlDocument(new File("history.xml"));
|
||||||
|
|
||||||
string data;
|
string data;
|
||||||
foreach (child; xml[0]["page"])
|
foreach (child; xml[0]["page"])
|
||||||
if (child.tag=="revision")
|
if (child.tag=="revision")
|
||||||
{
|
{
|
||||||
|
fwritefln(stderr, "Revision %s", child["id"].text);
|
||||||
string summary = child["comment"] ? child["comment"].text : null;
|
string summary = child["comment"] ? child["comment"].text : null;
|
||||||
string text = child["text"].text;
|
string text = child["text"].text;
|
||||||
data ~=
|
data ~=
|
||||||
|
|
Loading…
Reference in New Issue