Add --version flag

This commit is contained in:
klzgrad 2018-12-10 02:22:09 -05:00
parent 6ed1841ad0
commit 0cb7454962

View File

@ -23,6 +23,7 @@
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/version_info/version_info.h"
#include "net/base/auth.h"
#include "net/dns/host_resolver.h"
#include "net/dns/mapped_host_resolver.h"
@ -146,6 +147,7 @@ bool ParseCommandLineFlags(Params* params) {
"\n"
"Options:\n"
"-h, --help Show this message\n"
"--version Print version\n"
"--addr=<address> Address to listen on (0.0.0.0)\n"
"--port=<port> Port to listen on (1080)\n"
"--proto=[socks|http] Protocol to accept (socks)\n"
@ -158,6 +160,12 @@ bool ParseCommandLineFlags(Params* params) {
return false;
}
if (line.HasSwitch("version")) {
LOG(INFO) << "Version: " << version_info::GetVersionNumber();
exit(EXIT_SUCCESS);
return false;
}
params->listen_addr = "0.0.0.0";
if (line.HasSwitch("addr")) {
params->listen_addr = line.GetSwitchValueASCII("addr");