diff options
-rw-r--r-- | main.c | 49 | ||||
-rw-r--r-- | src/distro.c | 1 | ||||
-rw-r--r-- | src/distro.h | 2 | ||||
-rw-r--r-- | src/logo/openbsd.h | 34 |
4 files changed, 81 insertions, 5 deletions
@@ -19,12 +19,39 @@ const char *sofname = "farfetch"; const char *version = "0.0.1"; int main() { +#if defined(__OpenBSD__) +#include "src/logo/openbsd.h" +#else +#define COLOR "\e[1;30m" +#define RESET "\e[0m" + char *LOGO[] = { +" ⢀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⣠⠾⠛⠶⣄⢀⣠⣤⠴⢦⡀⠀⠀⠀⠀", +"⠀⠀⠀⢠⡿⠉⠉⠉⠛⠶⠶⠖⠒⠒⣾⠋⠀⢀⣀⣙⣯⡁⠀⠀⠀⣿⠀⠀⠀⠀", +"⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⢸⡏⠀⠀⢯⣼⠋⠉⠙⢶⠞⠛⠻⣆⠀⠀⠀", +"⠀⠀⠀⢸⣧⠆⠀⠀⠀⠀⠀⠀⠀⠀⠻⣦⣤⡤⢿⡀⠀⢀⣼⣷⠀⠀⣽⠀⠀⠀", +"⠀⠀⠀⣼⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⢏⡉⠁⣠⡾⣇⠀⠀⠀", +"⠀⠀⢰⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠋⠉⠀⢻⡀⠀⠀", +"⣀⣠⣼⣧⣤⠀⠀⠀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⠀⠀⠐⠖⢻⡟⠓⠒", +"⠀⠀⠈⣷⣀⡀⠀⠘⠿⠇⠀⠀⠀⢀⣀⣀⠀⠀⠀⠀⠿⠟⠀⠀⠀⠲⣾⠦⢤⠀", +"⠀⠀⠋⠙⣧⣀⡀⠀⠀⠀⠀⠀⠀⠘⠦⠼⠃⠀⠀⠀⠀⠀⠀⠀⢤⣼⣏⠀⠀⠀", +"⠀⠀⢀⠴⠚⠻⢧⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⠞⠉⠉⠓⠀⠀", +"⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠛⠶⠶⠶⣶⣤⣴⡶⠶⠶⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀" + }; +#endif + + printf("%s ", LOGO[0]); + printf(COLOR); display_user_name(); + printf(RESET); printf("@"); + printf(COLOR); display_user_host(); + printf(RESET); + printf("%s ", LOGO[1]); printf("------------------\n"); - printf("OS: "); + printf("%s ", LOGO[2]); + printf(COLOR"%s%s"RESET, "OS", ": "); display_os_name(); printf(" "); display_os_vers(); @@ -33,37 +60,49 @@ int main() { printf("\n"); #if defined(__linux__) - printf("Distro: "); + printf(COLOR"%s%s"RESET, "Distro", ": "); display_distro(); printf("\n"); #endif + printf("%s ", LOGO[3]); + printf(COLOR"%s%s"RESET, "Host", ": "); printf("Host: "); display_host_model(); printf("\n"); - printf("Uptime: "); + printf("%s ", LOGO[4]); + printf(COLOR"%s%s"RESET, "Uptime", ": "); display_days(); printf(", "); display_time(); printf("\n"); #if defined(__OpenBSD__) - printf("Recording: audio = "); + printf("%s ", LOGO[5]); + printf(COLOR"%s%s"RESET, "Recording", ": "); + printf("audio = "); display_recording_audio(); printf(", video = "); display_recording_video(); printf("\n"); #endif - printf("CPU: "); + printf("%s ", LOGO[6]); + printf(COLOR"%s%s"RESET, "CPU", ": "); display_cpu(); printf("\n"); + printf("%s ", LOGO[7]); + printf(COLOR"%s%s"RESET, "Memory", ": "); printf("Memory: "); display_memory(); printf("\n"); + for (size_t i = 8; i < sizeof(LOGO) / sizeof(LOGO[0]); i++) { + printf("%s\n", LOGO[i]); + } + // TODO: // * ロゴ // * パッケージ diff --git a/src/distro.c b/src/distro.c index 8830e7c..75bf0a4 100644 --- a/src/distro.c +++ b/src/distro.c @@ -49,6 +49,7 @@ void display_distro() { while (fgets(buf, sizeof(buf), p) != NULL) { buf[strcspn(buf, "\n")] = '\0'; printf("%s", buf); + distroname = buf; } pclose(p); diff --git a/src/distro.h b/src/distro.h index c4ecfd6..769fa81 100644 --- a/src/distro.h +++ b/src/distro.h @@ -4,5 +4,7 @@ void display_distro(); +const char *distroname; + #endif #endif diff --git a/src/logo/openbsd.h b/src/logo/openbsd.h new file mode 100644 index 0000000..ae0474a --- /dev/null +++ b/src/logo/openbsd.h @@ -0,0 +1,34 @@ +#define GREY "\e[1;30m" +#define RED "\e[1;31m" +#define YELLOW "\e[1;33m" +#define CYAN "\e[1;36m" +#define RESET "\e[0m" + +#define COLOR YELLOW +#define TITLECOLOR YELLOW + +char *LOGO[] = { +CYAN " _ " RESET, +CYAN " (_) " RESET, +YELLOW " | . " RESET, +YELLOW " . |L /| . " CYAN "_ " RESET, +YELLOW " _ . |\\ _| \\--+._/| . " CYAN " (_) " RESET, +YELLOW " / ||\\| Y J ) / |/| ./ " RESET, +YELLOW " J |)'( | ` F`.'/ " CYAN " _ " RESET, +YELLOW " -<| F __ .-< " CYAN " (_) " RESET, +YELLOW " | / .-'" CYAN "." YELLOW " `. /" CYAN "-. " YELLOW "L___ " RESET, +YELLOW " J \\ < " CYAN "\\ " YELLOW " | |" GREY " O" CYAN "\\" YELLOW "|.-' " CYAN " _ " RESET, +YELLOW " _J \\ .- \\" CYAN "/" GREY " O " CYAN "|" YELLOW" | \\ |F " CYAN " (_) " RESET, +YELLOW " '-F -<_. \\ .-' `-' L__ " RESET, +YELLOW "__J _ _. >-' )" RED "._." YELLOW " |-' " RESET, +YELLOW " `-|.' /_. " RED "\\_|" YELLOW " F " RESET, +YELLOW " /.- . _.< " RESET, +YELLOW " /' /.' .' `\\ " RESET, +YELLOW " /L /' |/ _.-'-\\ " RESET, +YELLOW " /'J ___.---'\\| " RESET, +YELLOW " |\\ .--' V | `. ` " RESET, +YELLOW " |/`. `-. `._) " RESET, +YELLOW " / .-.\\ " RESET, +YELLOW " \\ ( `\\ " RESET, +YELLOW " `.\\ " RESET +}; |