mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-12-24 03:05:50 +01:00
Add --version flag (#132)
This commit is contained in:
parent
90fed9b9a7
commit
bcd0c8eaa5
@ -142,6 +142,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
td::OptionParser options;
|
||||
bool need_print_usage = false;
|
||||
bool need_print_version = false;
|
||||
int http_port = 8081;
|
||||
int http_stat_port = 0;
|
||||
td::string http_ip_address = "0.0.0.0";
|
||||
@ -173,6 +174,7 @@ int main(int argc, char *argv[]) {
|
||||
options.set_usage(td::Slice(argv[0]), "--api-id=<arg> --api-hash=<arg> [--local] [OPTION]...");
|
||||
options.set_description("Telegram Bot API server");
|
||||
options.add_option('h', "help", "display this help text and exit", [&] { need_print_usage = true; });
|
||||
options.add_option('\0', "version", "display version number and exit", [&] { need_print_version = true; });
|
||||
options.add_option('\0', "local", "allow the Bot API server to serve local requests",
|
||||
[&] { parameters->local_mode_ = true; });
|
||||
options.add_checked_option(
|
||||
@ -275,6 +277,10 @@ int main(int argc, char *argv[]) {
|
||||
LOG(PLAIN) << options;
|
||||
return 0;
|
||||
}
|
||||
if (need_print_version) {
|
||||
LOG(PLAIN) << "Bot API " << parameters->version_;
|
||||
return 0;
|
||||
}
|
||||
if (r_non_options.is_error()) {
|
||||
LOG(PLAIN) << argv[0] << ": " << r_non_options.error();
|
||||
LOG(PLAIN) << options;
|
||||
|
Loading…
Reference in New Issue
Block a user