2024-03-20 09:42:02 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2024-03-21 17:01:09 -04:00
|
|
|
#include "color.h"
|
|
|
|
#include "basic.h"
|
|
|
|
#include "full.h"
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
#define VERSION "0.0.1"
|
|
|
|
#define INDENT " "
|
|
|
|
|
2024-03-20 09:42:02 -04:00
|
|
|
#define RESET "\x1b[0m"
|
|
|
|
|
2024-03-20 09:59:22 -04:00
|
|
|
#define RAINBOW "rainbow"
|
2024-03-21 12:29:17 -04:00
|
|
|
#define AROACE "aroace"
|
|
|
|
#define BISEXUAL "bisexual"
|
2024-03-21 18:18:14 -04:00
|
|
|
#define GAY "gay"
|
2024-03-20 09:59:22 -04:00
|
|
|
#define LESBIAN "lesbian"
|
|
|
|
#define NONBINARY "nonbinary"
|
2024-03-21 12:29:17 -04:00
|
|
|
#define PANSEXUAL "pansexual"
|
2024-03-20 09:59:22 -04:00
|
|
|
#define TRANSGENDER "transgender"
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
void version() {
|
|
|
|
printf("pride-c v" VERSION "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void help() {
|
|
|
|
version();
|
|
|
|
printf(
|
|
|
|
"Valerie Wolfe <sleeplessval@gmail.com>\n"
|
|
|
|
"Display 256-color pride flags in the terminal.\n\n"
|
|
|
|
|
|
|
|
"usage: pride [name]\n\n"
|
|
|
|
|
|
|
|
"flag names:\n"
|
|
|
|
INDENT AROACE "\n"
|
|
|
|
INDENT BISEXUAL "\n"
|
2024-03-21 18:18:14 -04:00
|
|
|
INDENT GAY "\n"
|
2024-03-21 14:11:06 -04:00
|
|
|
INDENT LESBIAN "\n"
|
|
|
|
INDENT NONBINARY "\n"
|
|
|
|
INDENT PANSEXUAL "\n"
|
|
|
|
INDENT RAINBOW "\n"
|
|
|
|
INDENT TRANSGENDER "\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-03-20 09:42:02 -04:00
|
|
|
int main(int argc, char **argv) {
|
2024-03-21 12:29:17 -04:00
|
|
|
// get argv[1] or fall back to RAINBOW
|
2024-03-20 09:42:02 -04:00
|
|
|
char *flag;
|
|
|
|
if(argc > 1) { flag = argv[1]; }
|
2024-03-20 09:59:22 -04:00
|
|
|
else { flag = RAINBOW; }
|
2024-03-20 09:42:02 -04:00
|
|
|
|
2024-03-21 17:01:09 -04:00
|
|
|
int color_mode = 0;
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
// handle flags
|
|
|
|
if(strcmp(flag, "--version") == 0) {
|
|
|
|
version();
|
|
|
|
return 0;
|
|
|
|
} else if(strcmp(flag, "--help") == 0) {
|
|
|
|
help();
|
|
|
|
return 0;
|
|
|
|
}
|
2024-03-21 12:29:17 -04:00
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
if(strcmp(flag, RAINBOW) == 0) { // - RAINBOW -
|
2024-03-21 17:01:09 -04:00
|
|
|
if(color_mode)
|
|
|
|
rainbow_256();
|
|
|
|
else
|
|
|
|
rainbow_8();
|
2024-03-21 12:29:17 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
else if(strcmp(flag, AROACE) == 0) { // - ARO/ACE -
|
2024-03-21 17:01:09 -04:00
|
|
|
if(color_mode)
|
|
|
|
aroace_256();
|
|
|
|
else
|
|
|
|
aroace_8();
|
2024-03-21 12:29:17 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
else if(strcmp(flag, BISEXUAL) == 0) { // - BISEXUAL -
|
2024-03-21 17:01:09 -04:00
|
|
|
if(color_mode)
|
2024-03-21 18:18:14 -04:00
|
|
|
bisexual_256();
|
2024-03-21 17:01:09 -04:00
|
|
|
else
|
|
|
|
bisexual_8();
|
2024-03-20 09:42:02 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 18:18:14 -04:00
|
|
|
else if(strcmp(flag, GAY) == 0) { // - GAY -
|
|
|
|
if(color_mode)
|
|
|
|
gay_256();
|
|
|
|
else
|
|
|
|
gay_8();
|
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
else if(strcmp(flag, LESBIAN) == 0) { // - LESBIAN -
|
2024-03-21 17:01:09 -04:00
|
|
|
if(color_mode)
|
|
|
|
lesbian_256();
|
|
|
|
else
|
|
|
|
lesbian_8();
|
2024-03-20 09:42:02 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
else if(strcmp(flag, NONBINARY) == 0) { // - NONBINARY -
|
2024-03-21 17:01:09 -04:00
|
|
|
if(color_mode)
|
|
|
|
nonbinary_256();
|
|
|
|
else
|
|
|
|
nonbinary_8();
|
2024-03-21 12:29:17 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
else if(strcmp(flag, PANSEXUAL) == 0) { // - PANSEXUAL -
|
2024-03-21 17:01:09 -04:00
|
|
|
if(color_mode)
|
|
|
|
pansexual_256();
|
|
|
|
else
|
|
|
|
pansexual_8();
|
2024-03-20 09:42:02 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
else if(strcmp(flag, TRANSGENDER) == 0) { // - TRANSGENDER -
|
2024-03-21 17:01:09 -04:00
|
|
|
if(color_mode)
|
|
|
|
transgender_256();
|
|
|
|
else
|
|
|
|
transgender_8();
|
2024-03-20 09:42:02 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
|
|
|
|
else {
|
|
|
|
printf("pride-c: no flag '%s' found.", flag);
|
|
|
|
return 1;
|
|
|
|
}
|
2024-03-20 09:42:02 -04:00
|
|
|
printf(RESET);
|
2024-03-21 14:11:06 -04:00
|
|
|
return 0;
|
2024-03-20 09:42:02 -04:00
|
|
|
}
|
|
|
|
|