Refine help message of client examples.
This commit is contained in:
@@ -50,6 +50,10 @@ int main() {
|
|||||||
|
|
||||||
} catch (const webcc::Error& error) {
|
} catch (const webcc::Error& error) {
|
||||||
std::cerr << error << std::endl;
|
std::cerr << error << std::endl;
|
||||||
|
return 1;
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -5,19 +5,20 @@
|
|||||||
#include "webcc/client_session.h"
|
#include "webcc/client_session.h"
|
||||||
#include "webcc/logger.h"
|
#include "webcc/logger.h"
|
||||||
|
|
||||||
void Help(const char* argv0) {
|
void Help() {
|
||||||
std::cout << "Usage: " << argv0 << " <upload_dir> [url]" << std::endl;
|
std::cout << "Usage:" << std::endl;
|
||||||
|
std::cout << " file_upload_client <upload_dir> [url]" << std::endl;
|
||||||
std::cout << "Default Url: http://httpbin.org/post" << std::endl;
|
std::cout << "Default Url: http://httpbin.org/post" << std::endl;
|
||||||
std::cout << "E.g.," << std::endl;
|
std::cout << "E.g.," << std::endl;
|
||||||
std::cout << " " << argv0 << "E:/github/webcc/data/upload" << std::endl;
|
std::cout << " file_upload_client E:/github/webcc/data/upload"
|
||||||
std::cout << " " << argv0
|
|
||||||
<< "E:/github/webcc/data/upload http://httpbin.org/post"
|
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
std::cout << " file_upload_client E:/github/webcc/data/upload"
|
||||||
|
<< " http://httpbin.org/post" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
Help(argv[0]);
|
Help();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,16 +188,17 @@ void PrintBookList(const std::list<Book>& books) {
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
void Help(const char* argv0) {
|
void Help() {
|
||||||
std::cout << "Usage: " << argv0 << " <url> [timeout]" << std::endl;
|
std::cout << "Usage:" << std::endl;
|
||||||
|
std::cout << " rest_book_client <url> [timeout]" << std::endl;
|
||||||
std::cout << "E.g.," << std::endl;
|
std::cout << "E.g.," << std::endl;
|
||||||
std::cout << " " << argv0 << " http://localhost:8080" << std::endl;
|
std::cout << " rest_book_client http://localhost:8080" << std::endl;
|
||||||
std::cout << " " << argv0 << " http://localhost:8080 2" << std::endl;
|
std::cout << " rest_book_client http://localhost:8080 2" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
Help(argv[0]);
|
Help();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user