diff --git a/src/main.cpp b/src/main.cpp index d5a80d1..73a85fe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,7 @@ void print_help() { std::cout << " -l, --lower allow lower case letters\n"; std::cout << " -u, --upper allow upper case letters\n"; std::cout << " -s, --symbol allow symbols and punctuation\n"; + std::cout << " -S, --special allow symbols from specified argument\n"; std::cout << "When none of -d, -l, -u, and -s are given, pw acts as if all had been specified.\n"; } @@ -46,10 +47,11 @@ int main(int argc, char* argv[]) { {"lower", no_argument, nullptr, 'l'}, {"digit", no_argument, nullptr, 'd'}, {"symbol", no_argument, nullptr, 's'}, + {"special", required_argument, nullptr, 'S'}, {"count", required_argument, nullptr, 'c'}, {nullptr, 0, nullptr, 0} }; - while ((opt_char = getopt_long(argc, argv, "c:hulds", long_options, nullptr)) != -1) { + while ((opt_char = getopt_long(argc, argv, "c:huldsS:", long_options, nullptr)) != -1) { std::string arg {optarg ? optarg : ""}; switch (opt_char) { case 0: { @@ -80,6 +82,10 @@ int main(int argc, char* argv[]) { noflags = false; valid += symbols; break; + case 'S': + noflags = false; + valid += arg; + break; case 'c': len = std::stoi(optarg); break;