diff options
-rw-r--r-- | docs/README.md | 7 | ||||
-rw-r--r-- | docs/screenshot1.png | bin | 0 -> 28376 bytes | |||
-rw-r--r-- | docs/screenshot2.png | bin | 0 -> 33241 bytes | |||
-rw-r--r-- | docs/tml-config.5.gz | bin | 2153 -> 2150 bytes | |||
-rw-r--r-- | docs/tml-config.md | 4 | ||||
-rw-r--r-- | draw.c | 6 | ||||
-rw-r--r-- | group.c | 4 | ||||
-rw-r--r-- | read_cfg.c | 18 | ||||
-rw-r--r-- | read_cfg.h | 2 |
9 files changed, 35 insertions, 6 deletions
diff --git a/docs/README.md b/docs/README.md index 9a7db57..db5da29 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,7 +4,7 @@ ## Compiling and Running -tml can be compiled on any system with gcc and the ncurses library installed. It has been tested to work on Ubuntu, and can also be compiled and run on Windows 10, but is designed with Linux in mind. To compile and run tml: +tml can be compiled on any system with make, gcc, and the ncurses library (libncurses-dev) installed. It has been tested to work on Ubuntu, and can also be compiled and run on Windows 10, but is designed with Linux in mind. To compile and run tml: 1. Clone the repository 2. Run `make` in the directory the repository was cloned into. This will create a file called `tml` @@ -27,6 +27,11 @@ To uninstall these files: sudo make uninstall ``` +## Screenshots + +![screenshot 1](screenshot1.png) +![screenshot 2](screenshot2.png) + ## Configuration File By default, tml searches in the following order for a configuration file: diff --git a/docs/screenshot1.png b/docs/screenshot1.png Binary files differnew file mode 100644 index 0000000..7c11b94 --- /dev/null +++ b/docs/screenshot1.png diff --git a/docs/screenshot2.png b/docs/screenshot2.png Binary files differnew file mode 100644 index 0000000..903304b --- /dev/null +++ b/docs/screenshot2.png diff --git a/docs/tml-config.5.gz b/docs/tml-config.5.gz Binary files differindex 8f06624..429dd3d 100644 --- a/docs/tml-config.5.gz +++ b/docs/tml-config.5.gz diff --git a/docs/tml-config.md b/docs/tml-config.md index 63f3cfb..b02ee21 100644 --- a/docs/tml-config.md +++ b/docs/tml-config.md @@ -126,7 +126,7 @@ autoAlias on # Adding a Group of Various Applications -addGroup Applcations +addGroup Applications addName GIMP /usr/bin/gimp Applications addName Chromium /usr/bin/chromium-browser Applications addName Thunderbird /usr/bin/thunderbird Applications @@ -141,7 +141,7 @@ add /home/john/Videos/*mp4 Videos addGroup Pictures setLauncher Pictures /usr/bin/sxiv -setFlags "-s f" +setFlags Pictures "-s f" add /home/john/Pictures/*jpg Pictures add /home/john/Pictures/*png Pictures addR "/mnt/External_Drive/Johns Photos/*" Pictures @@ -67,6 +67,12 @@ int main(int argc, char **argv){ g = get_groups(); //retrieve results of cfg_interp g_count = get_gcount(g); //retrieve number of groups in g (only do this after removing empty groups) + //check that there are is at least one valid group + if(g_count == 0){ + printf("Error: No Entries!\n"); + exit(0); + } + initscr(); cbreak(); keypad(stdscr, true); @@ -6,6 +6,7 @@ #include <unistd.h> #include "entry.h" #include "group.h" +#include "read_cfg.h" #define BUF_LEN 1024 typedef struct group{ @@ -143,7 +144,8 @@ void clean_groups(){ GROUP *hold; if(group_count == 0){ - printf("Error: no groups!\n"); + printf("Error: no groups! "); + refer_to_doc(); exit(0); } @@ -18,6 +18,7 @@ void cfg_interp(char *path); int get_compmode(); bool get_sort(); bool get_case_sensitivity(); +void refer_to_doc(); //private void check_line(char *buffer, char **options, int ln); @@ -60,10 +61,12 @@ char *find_config(){ for(i = 0; i < check_count; i++){ path = choices[i]; + printf("Checking for config at %s: ", choices[i]); if(access(path, R_OK) == 0){ - printf("Using config \"%s\"\n", path); + printf("Using config \"%s\"\n\n", path); return path; } + else printf("File does not exist\n"); } return "config"; @@ -80,7 +83,13 @@ void cfg_interp(char *path){ int j; fp = fopen(path, "r"); - assert(fp != NULL); + //assert(fp != NULL); + if(fp == NULL){ + printf("config does not exist in current directory. "); + refer_to_doc(); + exit(0); + } + else if(!strcmp(path, "config")) printf("Using config in current directory\n"); //build the options array char **options = malloc(sizeof(char *) * OPTION_CNT); @@ -134,6 +143,11 @@ bool get_case_sensitivity(){ return fold_case; } +void refer_to_doc(){ + printf("Refer to documentation on how to create tml config file\n"); + return; +} + //TODO add support for "addR" recursive adding (still needs work...) //TODO add support for "alias" option //TODO add support for "hide" option @@ -9,4 +9,6 @@ bool get_sort(); bool get_case_sensitivity(); +void refer_to_doc(); + #endif |