Rename functions command_* -> cmd_*

This commit is contained in:
Nicolás A. Ortega Froysa 2024-10-11 16:18:22 +02:00
parent e92a578d65
commit ba7f930231
3 changed files with 12 additions and 12 deletions

View File

@ -25,7 +25,7 @@
#include <vector> #include <vector>
#include <unistd.h> #include <unistd.h>
int command_add(void) { int cmd_add(void) {
std::string name, description, ingredients, tags; std::string name, description, ingredients, tags;
int recipe_id, ingredient_id, tag_id; int recipe_id, ingredient_id, tag_id;
@ -70,7 +70,7 @@ int command_add(void) {
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
int command_list(int argc, char *argv[]) { int cmd_list(int argc, char *argv[]) {
std::vector<std::string> ingredients, tags; std::vector<std::string> ingredients, tags;
int opt; int opt;
@ -106,7 +106,7 @@ int command_list(int argc, char *argv[]) {
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
int command_delete(int argc, char *argv[]) { int cmd_delete(int argc, char *argv[]) {
int ret = EXIT_SUCCESS; int ret = EXIT_SUCCESS;
std::vector<int> recipe_ids; std::vector<int> recipe_ids;
@ -138,7 +138,7 @@ int command_delete(int argc, char *argv[]) {
return ret; return ret;
} }
int command_info(const int id) { int cmd_info(const int id) {
struct recipe recipe; struct recipe recipe;
std::vector<std::string> ingredients, tags; std::vector<std::string> ingredients, tags;
int ret = EXIT_SUCCESS; int ret = EXIT_SUCCESS;

View File

@ -17,7 +17,7 @@
*/ */
#pragma once #pragma once
int command_add(void); int cmd_add(void);
int command_list(int argc, char *argv[]); int cmd_list(int argc, char *argv[]);
int command_delete(int argc, char *argv[]); int cmd_delete(int argc, char *argv[]);
int command_info(const int id); int cmd_info(const int id);

View File

@ -37,16 +37,16 @@ int main(int argc, char *argv[]) {
switch(id) { switch(id) {
case CMD_ADD: case CMD_ADD:
ret = command_add(); ret = cmd_add();
break; break;
case CMD_LIST: case CMD_LIST:
ret = command_list(argc - 1, argv + 1); ret = cmd_list(argc - 1, argv + 1);
break; break;
case CMD_DEL: case CMD_DEL:
ret = command_delete(argc - 2, argv + 2); ret = cmd_delete(argc - 2, argv + 2);
break; break;
case CMD_INFO: case CMD_INFO:
ret = command_info(std::stoi(argv[2])); ret = cmd_info(std::stoi(argv[2]));
break; break;
case CMD_HELP: case CMD_HELP:
print_help(); print_help();