aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ascii/ascii_hammer.ascii18
-rw-r--r--ascii/east_germany.ascii9
-rw-r--r--ascii/soviet_star.ascii7
-rw-r--r--src/ascii.c5
-rw-r--r--src/cfetch.c61
5 files changed, 97 insertions, 3 deletions
diff --git a/ascii/ascii_hammer.ascii b/ascii/ascii_hammer.ascii
new file mode 100644
index 0000000..cfe790c
--- /dev/null
+++ b/ascii/ascii_hammer.ascii
@@ -0,0 +1,18 @@
+ ########## #
+ ########## ###
+ ########## ####
+ ########### #####
+ ########## ##### ######
+ ##### ##### ######
+ # ##### #######
+ ##### #######
+ ##### #######
+ ##### ########
+ #############
+ ## ##########
+ ####### ##############
+ ##### #############################
+ ##### ################### #####
+ ##### ####### #####
+##### #####
+## ##
diff --git a/ascii/east_germany.ascii b/ascii/east_germany.ascii
new file mode 100644
index 0000000..33f1d63
--- /dev/null
+++ b/ascii/east_germany.ascii
@@ -0,0 +1,9 @@
+╔════════════════════════╗
+║ ║
+║ ☭ DDR ☭ ║
+║ Deutsche Demokratische ║
+║ Republik ║
+║ ║
+╚════════════════════════╝
+Proletarier aller Länder,
+ vereinigt euch!
diff --git a/ascii/soviet_star.ascii b/ascii/soviet_star.ascii
new file mode 100644
index 0000000..3900c87
--- /dev/null
+++ b/ascii/soviet_star.ascii
@@ -0,0 +1,7 @@
+ _____________
+ / \
+| ☆ ☆ ☆ |
+| ☆ ☭ ☆ |
+| ☆ ☆ ☆ |
+ \_____________/
+Рабочие мира, объединяйтесь!
diff --git a/src/ascii.c b/src/ascii.c
index f1365db..328ec7f 100644
--- a/src/ascii.c
+++ b/src/ascii.c
@@ -19,13 +19,16 @@
#include <stddef.h>
#include <stdio.h>
-#define MAX_LOGOS 2
+#define MAX_LOGOS 5
static const struct ascii_mapping_t ascii_mappings[] =
{
{"cccp", "cccp.ascii"},
{"cccp_shield", "cccp_shield.ascii"},
+ {"ascii_hammer", "ascii_hammer.ascii"},
+ {"east_germany", "east_germany.ascii"},
+ {"soviet_star", "soviet_star.ascii"},
{NULL, NULL}
};
diff --git a/src/cfetch.c b/src/cfetch.c
index fd53ae5..c0ea8ab 100644
--- a/src/cfetch.c
+++ b/src/cfetch.c
@@ -24,12 +24,21 @@
#include <unistd.h>
#include <stddef.h>
+#define COMMAND(large, small) \
+ (!strcmp(argv[i], large) || !strcmp(argv[i], small))
+
+void parse_args(int argc, char** argv);
+void print_help();
+
+int main(int argc, char **argv)
+{
+ parse_args(argc, argv);
+
-int main(void) {
struct system_info_t info = { 0 };
//info.debug = 1;
// set default artwork
- info.ascii_art = 0;
+ info.ascii_art = 3;
// set systeminformation
// use // to uncomment or comment
@@ -54,3 +63,51 @@ int main(void) {
get_gpu
get_colours ?
*/
+
+void parse_cmd(int argc, char **argv)
+{
+ for (int i = 1; i < argc; i++) {
+ if (argv[i][0] != '-')
+ {
+ fprintf(stderr,
+ "Error: invalid option: \"%s\". An option must start with `-`\n",
+ argv[i]);
+ print_help();
+ exit(1);
+ }
+ if (COMMAND("--help", "-h")) {
+ print_help();
+ exit(1);
+ }
+ if (COMMAND("--version", "-v")) {
+ printf("cfetch version: 0.1.1\n");
+ exit(0);
+ } else {
+ fprintf(stderr,
+ "Error: invalid option: \"%s\"\n",
+ argv[i]);
+ print_help();
+ exit(1);
+ }
+ }
+
+ return;
+}
+
+void parse_args(int argc, char **argv)
+{
+ if (argc == 1) {
+ return;
+ }
+
+ parse_cmd(argc, argv);
+ return;
+}
+
+void print_help()
+{
+ printf("\ncfetch, the neofetch/commifetch clone!\n");
+ printf("\nusage: cfetch\t [-v | --version] [-h | --help]\n");
+ printf(" -v --version\t prints the current version of cfetch.\n");
+ printf(" -h --help\t prints the helper menu of cfetch.\n");
+}