summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-16 00:32:39 +0300
committerKostyantyn Ovechko <fastinetserver@gmail.com>2010-08-16 00:32:39 +0300
commit31875e2d3b20a61e6d255dde9b6aad9feaa9a67d (patch)
treec9177776f2cb4df4e0deef5320424552390472c3
parentAdd try...catch blocks to a few functions in request tool (diff)
downloadidfetch-31875e2d3b20a61e6d255dde9b6aad9feaa9a67d.tar.gz
idfetch-31875e2d3b20a61e6d255dde9b6aad9feaa9a67d.tar.bz2
idfetch-31875e2d3b20a61e6d255dde9b6aad9feaa9a67d.zip
Add show_help() function to tuiclient
-rw-r--r--request/utils.cpp4
-rw-r--r--tuiclient/str.cpp9
-rw-r--r--tuiclient/str.h3
-rw-r--r--tuiclient/tuiclient.cpp18
4 files changed, 25 insertions, 9 deletions
diff --git a/request/utils.cpp b/request/utils.cpp
index f60c6d2..ea7aaf8 100644
--- a/request/utils.cpp
+++ b/request/utils.cpp
@@ -27,8 +27,8 @@
#include "utils.h"
#include <iostream>
-void printout(string error_msg){
- cout<<error_msg<< endl;
+void printout(string msg){
+ cout<<msg<< endl;
}
ulong time_left_from(timeval from_time){
diff --git a/tuiclient/str.cpp b/tuiclient/str.cpp
index 351b2e5..ffa8890 100644
--- a/tuiclient/str.cpp
+++ b/tuiclient/str.cpp
@@ -58,13 +58,10 @@ vector <string> split_to_vector(string splitter, string str){
}
return parts;
}
-/*
-template<typename T> string toString(T t){
- stringstream s;
- s << t;
- return s.str();
+
+void printout(string msg){
+ cout<<msg<< endl;
}
-*/
string colorToString(uint a_color){
switch (a_color){
diff --git a/tuiclient/str.h b/tuiclient/str.h
index cb539ce..2076ec8 100644
--- a/tuiclient/str.h
+++ b/tuiclient/str.h
@@ -28,6 +28,7 @@
#define __STR_H__
#include <string>
#include <sstream>
+#include <iostream>
#include <algorithm>
#include <vector>
#include "log.h"
@@ -46,7 +47,7 @@ class Tparts{
int atoi(string num_str);
long atol(string num_str);
-//template<typename T> string toString(T t);
+void printout(string msg);
string colorToString(uint a_color);
string toString(uint t);
diff --git a/tuiclient/tuiclient.cpp b/tuiclient/tuiclient.cpp
index db99e73..0cac49d 100644
--- a/tuiclient/tuiclient.cpp
+++ b/tuiclient/tuiclient.cpp
@@ -275,6 +275,20 @@ void decode_log_msg(string msg_body){
void decode_error_log_msg(string msg_body){
mainwindow.error_log_win.add_line(msg_body);
}
+
+void show_help(){
+ try{
+ printout("Usage: tuiclient [OPTIONS]");
+ printout("Options:");
+ printout("--help Show this help.");
+ printout("--wait-distfiles=df_name1,df_name2,...,df_nameN Wait for specified distfiles to download and quit.");
+ printout("");
+ exit(0);
+ }catch(...){
+ printout("Error in request.cpp: show_help()");
+ }
+}
+
int parse_cli_arguments(int argc, char* argv[]){
try{
string option,name,value;
@@ -286,6 +300,10 @@ int parse_cli_arguments(int argc, char* argv[]){
posEqual=option.find('=');
name = trim(option.substr(0,posEqual));
value = trim(option.substr(posEqual+1));
+ if (name=="--help"){
+ show_help();
+ continue;
+ };
if (name=="--wait-distfiles"){
settings.arg_wait_distfiles=value;
settings.wait_distfiles_vector=split_to_vector(",", value);