From 0c593583dccd88e90450972e6a1b9e6bc67e0911 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 4 Aug 2015 04:37:12 +0300 Subject: utils: bugfix & refactoring --- utils/decrypt_file.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'utils/decrypt_file.cpp') diff --git a/utils/decrypt_file.cpp b/utils/decrypt_file.cpp index 3e08d6f..2e4da3b 100644 --- a/utils/decrypt_file.cpp +++ b/utils/decrypt_file.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details. */ -#include "file_common.hpp" +#include "file_cmd_parser.hpp" #include @@ -20,8 +20,8 @@ #include #include #include +#include #include -#include #include namespace @@ -165,13 +165,20 @@ int main(int argc, char** argv) try { CommandLineParser cmd_parser("decrypt_file.exe"); + cmd_parser.parse(argc, argv); - if (!cmd_parser.parse_options(argc, argv)) + if (cmd_parser.requested_help()) + { + std::cout << cmd_parser; return 0; + } + + std::deque args{ std::make_move_iterator(cmd_parser.args.begin()), + std::make_move_iterator(cmd_parser.args.end()) }; - if (!decrypt_file(cmd_parser.get_algorithm(), cmd_parser.get_mode(), cmd_parser.get_args())) + if (!decrypt_file(cmd_parser.algorithm, cmd_parser.mode, args)) { - cmd_parser.print_usage(); + std::cout << cmd_parser; return 1; } -- cgit v1.2.3