mirror of
https://github.com/fmang/opustags.git
synced 2025-07-09 10:55:10 +02:00
Restyle to K&R
This commit is contained in:
16
src/main.cc
16
src/main.cc
@ -24,8 +24,7 @@ static void show_usage(const bool include_help)
|
||||
|
||||
std::cout << "opustags v" << version << "\n";
|
||||
std::cout << usage;
|
||||
if (include_help)
|
||||
{
|
||||
if (include_help) {
|
||||
std::cout << "\n";
|
||||
std::cout << help;
|
||||
}
|
||||
@ -33,25 +32,20 @@ static void show_usage(const bool include_help)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc == 1)
|
||||
{
|
||||
if (argc == 1) {
|
||||
show_usage(false);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
const auto options = opustags::parse_args(argc, argv);
|
||||
if (options.show_help)
|
||||
{
|
||||
if (options.show_help) {
|
||||
show_usage(true);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
std::cout << "Working...\n";
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
} catch (const std::exception &e) {
|
||||
std::cerr << e.what();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -36,12 +36,10 @@ Options opustags::parse_args(const int argc, char **argv)
|
||||
Options options;
|
||||
char c;
|
||||
optind = 0;
|
||||
while ((c = getopt_long(argc, argv, short_def, long_def, nullptr)) != -1)
|
||||
{
|
||||
while ((c = getopt_long(argc, argv, short_def, long_def, nullptr)) != -1) {
|
||||
const std::string arg(optarg == nullptr ? "" : optarg);
|
||||
|
||||
switch (c)
|
||||
{
|
||||
switch (c) {
|
||||
case 'h':
|
||||
options.show_help = true;
|
||||
break;
|
||||
|
@ -21,9 +21,8 @@ namespace opustags
|
||||
std::vector<std::string> to_delete;
|
||||
};
|
||||
|
||||
class ArgumentError : public std::runtime_error
|
||||
struct ArgumentError : std::runtime_error
|
||||
{
|
||||
public:
|
||||
ArgumentError(const std::string &message);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user