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

Add handling for invalid commands in main.cc #750

Merged
merged 2 commits into from
Feb 18, 2025

Conversation

fbarbe00
Copy link
Contributor

This is a minor change

Description

This PR improves the user experience by adding handling for invalid commands in exe/main.cc. When a user enters an unrecognized command, the program will now print "Invalid command. Type motis --help for a list of commands."

Added a default case to the switch statement in the main function to
handle invalid commands.
This improves user experience by providing guidance when an invalid
command is used.
@felixguendling
Copy link
Member

The protobuf shutdown was placed wrong it seems. Maybe remove it for now. Or save the return value in a variable so you can return it after protobuf shutdown.

@fbarbe00
Copy link
Contributor Author

Hi @felixguendling , I have added a commit that introduces a new variable to return after the protobuf shutdown

The protobuf shutdown was previously never called, given that all switch
cases returned before it.
This commit introduces a new variable to store the return value to store
the command execution, and returns after the proper shutdown of the Protobuf
library to prevent resource leaks
@fbarbe00
Copy link
Contributor Author

My bad! Fixed.

@felixguendling felixguendling merged commit 05be7ea into motis-project:master Feb 18, 2025
11 of 12 checks passed
@felixguendling
Copy link
Member

thank you! 🥳

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.

2 participants