merge --custom and --image
This commit is contained in:
parent
119504feb4
commit
e4acabada7
1 changed files with 6 additions and 7 deletions
13
uwufetch.c
13
uwufetch.c
|
@ -81,25 +81,20 @@ int main(int argc, char *argv[]) {
|
||||||
int opt = 0;
|
int opt = 0;
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{ "ascii", no_argument, NULL, 'a' },
|
{ "ascii", no_argument, NULL, 'a' },
|
||||||
{ "custom", required_argument, NULL, 'c' },
|
|
||||||
{ "config", required_argument, NULL, 0},
|
{ "config", required_argument, NULL, 0},
|
||||||
{ "distro", required_argument, NULL, 'd' },
|
{ "distro", required_argument, NULL, 'd' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ "image", no_argument, NULL, 'i' },
|
{ "image", optional_argument, NULL, 'i' },
|
||||||
{ "list", no_argument, NULL, 'l' },
|
{ "list", no_argument, NULL, 'l' },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
get_info();
|
get_info();
|
||||||
parse_config();
|
parse_config();
|
||||||
while ((opt = getopt_long(argc, argv, "ad:hilc:", long_options, NULL)) != -1) {
|
while ((opt = getopt_long(argc, argv, "ad:hi::l", long_options, NULL)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'a':
|
case 'a':
|
||||||
ascii_image_flag = 0;
|
ascii_image_flag = 0;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
|
||||||
ascii_image_flag = 1;
|
|
||||||
sprintf(image_name, "%s", optarg);
|
|
||||||
break;
|
|
||||||
case 'd':
|
case 'd':
|
||||||
if (optarg) sprintf(version_name, "%s", optarg);
|
if (optarg) sprintf(version_name, "%s", optarg);
|
||||||
break;
|
break;
|
||||||
|
@ -108,6 +103,10 @@ int main(int argc, char *argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
case 'i':
|
case 'i':
|
||||||
ascii_image_flag = 1;
|
ascii_image_flag = 1;
|
||||||
|
char *image_dir = NULL;
|
||||||
|
if(!optarg && argv[optind] != NULL && argv[optind][0] != '-') image_dir = argv[optind++];
|
||||||
|
else image_dir = optarg;
|
||||||
|
if(image_dir != NULL) sprintf(image_name, "%s", image_dir);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
list(argv[0]);
|
list(argv[0]);
|
||||||
|
|
Loading…
Reference in a new issue