2024-03-20 09:42:02 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.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-21 12:29:17 -04:00
|
|
|
#define COLOR(n) "\x1b[38;5;" #n "m"
|
|
|
|
#define BLACK "\x1b[38;5;0m"
|
|
|
|
#define WHITE "\x1b[38;5;255m"
|
2024-03-20 09:42:02 -04:00
|
|
|
|
|
|
|
#define STRIPE "██████████████████\n"
|
|
|
|
|
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-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"
|
|
|
|
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 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 -
|
|
|
|
printf(COLOR(196) STRIPE); // red
|
|
|
|
printf(COLOR(208) STRIPE); // orange
|
|
|
|
printf(COLOR(220) STRIPE); // yellow
|
|
|
|
printf(COLOR(28) STRIPE); // green
|
|
|
|
printf(COLOR(21) STRIPE); // blue
|
|
|
|
printf(COLOR(90) STRIPE); // purple
|
2024-03-21 12:29:17 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
else if(strcmp(flag, AROACE) == 0) { // - ARO/ACE -
|
|
|
|
printf(COLOR(172) STRIPE); // orange
|
|
|
|
printf(COLOR(184) STRIPE); // yellow
|
|
|
|
printf(WHITE STRIPE); // white
|
|
|
|
printf(COLOR(38) STRIPE); // blue
|
|
|
|
printf(COLOR(17) STRIPE); // navy
|
2024-03-21 12:29:17 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
else if(strcmp(flag, BISEXUAL) == 0) { // - BISEXUAL -
|
|
|
|
printf(COLOR(161) STRIPE STRIPE); // maroon
|
|
|
|
printf(COLOR(91) STRIPE); // purple
|
|
|
|
printf(COLOR(21) STRIPE STRIPE); // blue
|
2024-03-20 09:42:02 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
else if(strcmp(flag, LESBIAN) == 0) { // - LESBIAN -
|
|
|
|
printf(COLOR(202) STRIPE); // orange
|
|
|
|
printf(COLOR(209) STRIPE); // tangerine
|
|
|
|
printf(WHITE STRIPE); // white
|
|
|
|
printf(COLOR(205) STRIPE); // pink
|
|
|
|
printf(COLOR(161) STRIPE); // magenta
|
2024-03-20 09:42:02 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
else if(strcmp(flag, NONBINARY) == 0) { // - NONBINARY -
|
|
|
|
printf(COLOR(226) STRIPE); // yellow
|
|
|
|
printf(WHITE STRIPE); // white
|
|
|
|
printf(COLOR(134) STRIPE); // purple
|
|
|
|
printf(BLACK STRIPE); // black
|
2024-03-21 12:29:17 -04:00
|
|
|
}
|
|
|
|
|
2024-03-21 14:11:06 -04:00
|
|
|
else if(strcmp(flag, PANSEXUAL) == 0) { // - PANSEXUAL -
|
|
|
|
printf(COLOR(161) STRIPE STRIPE); // magenta
|
|
|
|
printf(COLOR(220) STRIPE STRIPE); // yellow
|
|
|
|
printf(COLOR(45) STRIPE STRIPE); // cyan
|
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 12:29:17 -04:00
|
|
|
char *blue = COLOR(45) STRIPE;
|
|
|
|
char *pink = COLOR(177) STRIPE;
|
|
|
|
printf(blue);
|
|
|
|
printf(pink);
|
2024-03-20 09:42:02 -04:00
|
|
|
printf(WHITE STRIPE);
|
2024-03-21 12:29:17 -04:00
|
|
|
printf(pink);
|
|
|
|
printf(blue);
|
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
|
|
|
}
|
|
|
|
|