summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md15
-rw-r--r--main.c4
2 files changed, 11 insertions, 8 deletions
diff --git a/README.md b/README.md
index 9ec3359..dd9b0e8 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# myal - My Anime Library
-My Anime Library is cli-tool to manage an anime watchlist, written in C.
+My Anime Library is a cli-tool written in C to manage an anime watchlist.
I used to track which anime I have watched and what episode I'm on by writing in
a text file, which got annoying after a while.
This is why I created a simple program to quickly search and change a
@@ -9,24 +9,25 @@ csv file.
Is it a complete overkill to write this in C? Yes
Could this have been a simple bash script? Definitely
-But why not?
+But why not? I wanted some practice with C, so if you see any glaring errors or
+unsafe code feel free to point it out and roast me.
This cli-tool works with csv files in the format
name,episode
-For example:
+For example:
Samurai Champloo,14
Bakemonogatari,done
Steins; Gate,1
and so on. The episode is actually stored as a string, so you can put "done" or
-"abandoned" or anything else you want in there. Allows for a maximum length of
-11.
+"abandoned" or anything else you want in there. The string allows for a maximum
+length of 11.
-You need to set your filepath in the main.c, but everything else should work
-out of the box.
+You need to set the filepath to you csv in the main.c, but everything else
+should work out of the box.
The Makefile uses clang, but you can change it to gcc in the second line. Or
you could simply do
diff --git a/main.c b/main.c
index 129aa04..b37cd63 100644
--- a/main.c
+++ b/main.c
@@ -26,6 +26,7 @@ void print_help()
printf(" -s <name> Search for a specific anime by name \n");
printf(" -a <name> <number> Append new anime and episode to file \n");
printf(" -e <name> <number> Edit the episode number of an anime \n");
+ printf(" -h Print this help menu \n");
printf("\n");
}
@@ -204,12 +205,13 @@ int main(int argc, char **argv)
{
mode_e mode;
int opt;
- while ((opt = getopt(argc, argv, "msae")) != -1) {
+ while ((opt = getopt(argc, argv, "msaeh")) != -1) {
switch (opt) {
case 'm': mode = MATCH_MODE; break;
case 's': mode = SEARCH_MODE; break;
case 'a': mode = APPEND_MODE; break;
case 'e': mode = EDIT_MODE; break;
+ case 'h': print_help(); exit(EXIT_SUCCESS);
default:
print_help();
exit(EXIT_FAILURE);