Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added function to handle version command line argument. Fixes #352 #355

Closed
wants to merge 1 commit into from

Conversation

biplab37
Copy link

Fixes #352

Proposed Changes

  • Added a function handleVersionCommandLineOption to handle the --version and -v command line options.

Copy link
Owner

@xeco23 xeco23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this! I think it's cleaner if we do this in a slightly different way as mentioned.

@@ -12,6 +16,23 @@ namespace
}
}

void handleVersionCommandLineOption(int argc, char** argv, bool& version)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move all the code into the Application class to make it cleaner? It also has access to argc and argv. Maybe even better, we can properly set the HANDLES_COMMAND_LINE flag and react on on_command_line of the Gtk::Application by overriding it like it's done here in the first answer: https://stackoverflow.com/questions/13852421/gtkmm-3-parse-command-line-with-gtkapplication

@@ -12,6 +16,23 @@ namespace
}
}

void handleVersionCommandLineOption(int argc, char** argv, bool& version)
{
Glib::OptionGroup optionGroup("options", "Command Line Options", "Show command line options");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use auto. This applies to all other variables.

@xeco23 xeco23 closed this Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide --version Option in Command-Line
2 participants