fixed
This commit is contained in:
parent
078b018ebc
commit
ce965804d3
@ -16,10 +16,14 @@ typedef struct {
|
|||||||
} FETCH;
|
} FETCH;
|
||||||
|
|
||||||
struct par {
|
struct par {
|
||||||
|
/* Text before */
|
||||||
char *str0;
|
char *str0;
|
||||||
|
|
||||||
|
/* Text after */
|
||||||
char *str1;
|
char *str1;
|
||||||
|
|
||||||
|
/* Command */
|
||||||
char *str2;
|
char *str2;
|
||||||
int error_flag;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -219,7 +219,7 @@ int GetModel(struct par par, const FETCH fetch) {
|
|||||||
if (ptr != NULL)
|
if (ptr != NULL)
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
|
|
||||||
printf("%s%.25s", FONT_COLOR, model_buffer);
|
printf("%s%s", FONT_COLOR, model_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
15
src/main.c
15
src/main.c
@ -6,7 +6,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
unsigned int l_flag = 0;
|
char l_flag = 0;
|
||||||
char *d_flag = NULL;
|
char *d_flag = NULL;
|
||||||
|
|
||||||
int opt;
|
int opt;
|
||||||
@ -22,7 +22,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
default:
|
default:
|
||||||
printf("kfetch [-hld]\n\t-h Help\n\t-l Dont print logo\n\t-d NAME\n");
|
printf("kfetch [-hld]\n\t-h Help\n\t-l Dont print logo\n\t-d STR Set STR as distro name\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,9 +33,11 @@ int main(int argc, char **argv) {
|
|||||||
GetArt(&fetch, 0);
|
GetArt(&fetch, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int flag = 0;
|
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
for (size_t i = 0; i < sizeof(CONFIG) / sizeof(PARAMETR); i++) {
|
for (size_t i = 0; i < sizeof(CONFIG) / sizeof(PARAMETR); i++) {
|
||||||
|
if (CONFIG[i].func == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
/* Print ascii logo */
|
/* Print ascii logo */
|
||||||
if (j < fetch.logo_size && !l_flag)
|
if (j < fetch.logo_size && !l_flag)
|
||||||
printf("%s", fetch.logo[j]);
|
printf("%s", fetch.logo[j]);
|
||||||
@ -45,13 +47,10 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
/* Function exec */
|
/* Function exec */
|
||||||
printf("%s%s", fetch.color, CONFIG[i].par.str0);
|
printf("%s%s", fetch.color, CONFIG[i].par.str0);
|
||||||
if (CONFIG[i].func(CONFIG[i].par, fetch)) {
|
if (CONFIG[i].func(CONFIG[i].par, fetch))
|
||||||
flag = 1;
|
|
||||||
printf("%s%s", FONT_COLOR, ON_ERROR_STR);
|
printf("%s%s", FONT_COLOR, ON_ERROR_STR);
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
flag = 0;
|
|
||||||
if (CONFIG[i].par.str1 != NULL)
|
if (CONFIG[i].par.str1 != NULL)
|
||||||
printf(CONFIG[i].par.str1, fetch.color);
|
printf(CONFIG[i].par.str1, fetch.color);
|
||||||
}
|
}
|
||||||
@ -60,7 +59,7 @@ int main(int argc, char **argv) {
|
|||||||
printf("\033[0m\n");
|
printf("\033[0m\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; j < fetch.logo_size; j++)
|
for (; j < fetch.logo_size - 1; j++)
|
||||||
if (!l_flag)
|
if (!l_flag)
|
||||||
printf("%s\n", fetch.logo[j]);
|
printf("%s\n", fetch.logo[j]);
|
||||||
|
|
||||||
|
32
themes/default.h
Normal file
32
themes/default.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef _CONFIG_H
|
||||||
|
#define _CONFIG_H
|
||||||
|
|
||||||
|
#include "fetch.h"
|
||||||
|
#include "structs.h"
|
||||||
|
|
||||||
|
/* Config, EDIT THERE */
|
||||||
|
#define COLORS " \033[31m<> \033[32m<> \033[33m<> \033[34m<> \033[35m<> \033[36m<>\033[0m"
|
||||||
|
#define FONT_COLOR "\033[1;37m"
|
||||||
|
|
||||||
|
#ifdef _MAIN_C
|
||||||
|
#define ON_ERROR_STR "none"
|
||||||
|
|
||||||
|
PARAMETR CONFIG[] = {
|
||||||
|
{PrintOs, {.str0=" os ", .str1=NULL}},
|
||||||
|
{GetKernel, {.str0=" kr ", .str1=NULL}},
|
||||||
|
{GetUser, {.str0=" usr ", .str1=NULL}},
|
||||||
|
{GetUptime, {.str0=" upt ", .str1=NULL}},
|
||||||
|
{GetArch, {.str0=" arch ", .str1=NULL}},
|
||||||
|
{GetShell, {.str0="shell ", .str1=NULL}},
|
||||||
|
{GetPkg, {.str0=" pkgs ", .str1=NULL}},
|
||||||
|
{GetMem, {.str0=" mem ", .str1=NULL}},
|
||||||
|
{GetModel, {.str0="model ", .str1=NULL}},
|
||||||
|
{GetHostname, {.str0=" host ", .str1=NULL}},
|
||||||
|
{GetAVG, {.str0=" AVG ", .str1=NULL}},
|
||||||
|
{Blank, {.str0=" ", .str1=NULL}},
|
||||||
|
{Execute, {.str0=" Id's ", .str1=NULL, .str2="id -gn"}},
|
||||||
|
{Blank, {.str0=COLORS, .str1=NULL}}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user