aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/utils/decrypt_file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/decrypt_file.cpp')
-rw-r--r--utils/decrypt_file.cpp17
1 files changed, 12 insertions, 5 deletions
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 <aesni/all.h>
@@ -20,8 +20,8 @@
#include <exception>
#include <fstream>
#include <iostream>
+#include <iterator>
#include <string>
-#include <utility>
#include <vector>
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<std::string> 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;
}