projmr/Application/argsconfig.c
2026-05-13 17:35:26 +04:00

70 lines
1.9 KiB
C

/*
* argsconfig.c
*
* Copyright 2025
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
#if !defined(__ARGSCONFIG_C__)
#define __ARGSCONFIG_C__
#include "../Library/argsconfig.h"
void projmr_argsconfig_help(void) {
puts(
"Projmr V2.0" PBREAK
PLINER "Simple manager for your C-projects" PENDLN
);
}
int projmr_argsconifg_parse(int argc, char** argv) {
unsigned int i = 1;
char* name = (char*)NULL;
while (i < (unsigned int)argc) {
char* str = argv[i];
if (str[0] == '-') {
unsigned char use_external = 0;
if (str[1] == '-') use_external = 1;
switch (str[1 + use_external]) {
case 'h':
projmr_argsconfig_help();
return EXIT_SUCCESS;
default:
projmr_error_log("Unknown token!");
return EXIT_FAILURE;
}
} else {
name = str;
}
i ++;
}
if (name) {
return projmr_run_creating(name);
} else {
projmr_error_log("Please specify the name of the project!");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
#endif /* __ARGSCONFIG_C__ */