19 |
|
|
20 |
|
int Usage() |
21 |
|
{ |
22 |
< |
api::Cout << _B("Usage: ") << api::GetExecutablePath().GetName() << _B(" [-sitemap=.+] -base=.+ [-fs=.*] [-blog=.*]") << ios::NewLine; |
22 |
> |
api::Cout << _B("Usage: ") << api::GetExecutablePath().GetName() << _B(" [-sitemap=.+] -base=.+ [-fs=.*] [-blog=.*] [-wiki=.*] [...]") << ios::NewLine; |
23 |
|
|
24 |
|
return 1; |
25 |
|
} |
29 |
|
cse::String sitemap(_B("sitemap.gz")), base; |
30 |
|
_L<_R<Command> > commands; |
31 |
|
|
32 |
< |
api::Pcre::RegEx sitemap_(_B("^-sitemap=(.+)$")), base_(_B("^-base=(.+)$")), fs_(_B("^-fs=(.*)$")), blog_(_B("^-blog=(.*)$")), exclude(_B("^-exclude=(.+)$")); |
32 |
> |
api::Pcre::RegEx sitemap_(_B("^-sitemap=(.+)$")), base_(_B("^-base=(.+)$")), fs(_B("^-fs=(.*)$")), blog(_B("^-blog=(.*)$")), wiki(_B("^-wiki=(.*)$")); |
33 |
|
|
34 |
|
_foreach (const app::ArgumentList, arg, app::GetArguments()) |
35 |
|
{ |
36 |
|
api::Pcre::RegEx::Match match; |
37 |
– |
_R<FileSystemCommand> fs; |
38 |
– |
_R<BlogCommand> blog; |
37 |
|
|
38 |
|
if (match = sitemap_(*arg)) |
39 |
|
sitemap = match[1]; |
40 |
|
else if (match = base_(*arg)) |
41 |
|
base = match[1]; |
42 |
< |
else if (match = fs_(*arg)) |
42 |
> |
else if (match = fs(*arg)) |
43 |
|
commands.InsertLast(new _H<FileSystemCommand>(match[1])); |
44 |
< |
else if (match = blog_(*arg)) |
44 |
> |
else if (match = blog(*arg)) |
45 |
|
commands.InsertLast(new _H<BlogCommand>(match[1])); |
46 |
+ |
else if (match = wiki(*arg)) |
47 |
+ |
commands.InsertLast(new _H<WikiCommand>(match[1])); |
48 |
|
else |
49 |
|
return Usage(); |
50 |
|
} |
64 |
|
threads.Add(hop::BindAll(&GoogleTron::FileSystem_, this, command)); |
65 |
|
else if (_R<BlogCommand> command = dynamic_cast<BlogCommand *>(command_->GetValue())) |
66 |
|
threads.Add(hop::BindAll(&GoogleTron::Blog_, this, command)); |
67 |
+ |
else if (_R<WikiCommand> command = dynamic_cast<WikiCommand *>(command_->GetValue())) |
68 |
+ |
threads.Add(hop::BindAll(&GoogleTron::Wiki_, this, command)); |
69 |
|
} |
70 |
|
|
71 |
|
GoogleTron::~GoogleTron() |
142 |
|
|
143 |
|
return 0; |
144 |
|
} |
145 |
+ |
|
146 |
+ |
int GoogleTron::Wiki_(const _R<WikiCommand> &command) |
147 |
+ |
{ |
148 |
+ |
Wiki wiki(sitemap, base, queue, queueLock, command); |
149 |
+ |
|
150 |
+ |
return 0; |
151 |
+ |
} |