Compare commits
3 Commits
d30f8df5c1
...
c31ccdece2
Author | SHA1 | Date | |
---|---|---|---|
c31ccdece2 | |||
d2f30dcca7 | |||
2434a516cd |
@ -118,6 +118,7 @@ int cmd_delete(int argc, char *argv[]) {
|
||||
|
||||
if(not db.recipe_exists(id)) {
|
||||
std::cerr << "No recipe exists with ID " << id << "." << std::endl;
|
||||
db.close();
|
||||
return EXIT_FAILURE;
|
||||
} else {
|
||||
recipe_ids.push_back(id);
|
||||
@ -134,12 +135,12 @@ int cmd_info(const int id) {
|
||||
db db;
|
||||
struct recipe recipe;
|
||||
std::vector<std::string> ingredients, tags;
|
||||
int ret = EXIT_SUCCESS;
|
||||
|
||||
db.open();
|
||||
|
||||
if(not db.recipe_exists(id)) {
|
||||
std::cerr << "No recipe with ID '" << id << "'";
|
||||
db.close();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@ -164,5 +165,5 @@ int cmd_info(const int id) {
|
||||
std::cout << "\t- " << tag << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
return ret;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
inline int get_recipe_id(const std::string &name) {
|
||||
return table_get_id_by_name("recipes", name);
|
||||
}
|
||||
inline bool db_recipe_exists(const std::string &name) {
|
||||
inline bool recipe_exists(const std::string &name) {
|
||||
return (get_recipe_id(name) > 0);
|
||||
}
|
||||
bool recipe_exists(const int id);
|
||||
@ -74,7 +74,7 @@ public:
|
||||
inline int get_ingredient_id(const std::string &name) {
|
||||
return table_get_id_by_name("ingredients", name);
|
||||
}
|
||||
inline bool db_ingredient_exists(const std::string &name) {
|
||||
inline bool ingredient_exists(const std::string &name) {
|
||||
return (get_ingredient_id(name) > 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user