Thumbnail

rani/cscroll.git

Clone URL: https://git.buni.party/rani/cscroll.git

commit 41f8303ddea5434d2e117c0fbf008efaaf0d2464 Author: Raniconduh <clagv.randomgames@gmail.com> Date: Mon Aug 29 09:33:17 2022 +0000 add -a & -A flags for oneshot mode diff --git a/include/opts.h b/include/opts.h index 2e3c76b..e9db966 100644 --- a/include/opts.h +++ b/include/opts.h @@ -426 +427 @@ extern uint32_t archive_color;  extern uint32_t custom_colors[11];    extern bool oneshot; +extern bool show_dot_dirs;      bool check_config(void); diff --git a/src/dir.c b/src/dir.c index d06e978..fd6fdea 100644 --- a/src/dir.c +++ b/src/dir.c @@ -647 +648 @@ int list_dir(char * dir_path) {   char * d_name = d_entry->d_name;   size_t d_name_len = strlen(d_name);   - if (!strcmp(d_name, ".") || !strcmp(d_name, "..")) { + if ((!strcmp(d_name, ".") || !strcmp(d_name, "..")) + && !show_dot_dirs) {   free(dir_entry);   continue;   } diff --git a/src/main.c b/src/main.c index 49cf031..7ff660d 100644 --- a/src/main.c +++ b/src/main.c @@ -386 +3811 @@ int main(int argc, char ** argv) {  #endif   } else if (!strcmp(argv[i], "-l")) {   p_long = true; + } else if (!strcmp(argv[i], "-A")) { + show_dot_files = true; + } else if (!strcmp(argv[i], "-a")) { + show_dot_dirs = true; + show_dot_files = true;   } else if (!strcmp(argv[i], "--help")) {   help();   } else if (!strcmp(argv[i], "--oneshot")) { @@ -536 +5811 @@ int main(int argc, char ** argv) {   }   }   + if (show_dot_dirs && !oneshot) { + fputs("-a is only available in oneshot mode\n", stderr); + exit(1); + } +   if (!cwd) {   char p[2048];   getcwd(p, sizeof(p)); diff --git a/src/opts.c b/src/opts.c index 9c910e4..6299596 100644 --- a/src/opts.c +++ b/src/opts.c @@ -186 +187 @@ bool show_dot_files = false;  bool color = true;  bool p_long = false;  bool oneshot = false; +bool show_dot_dirs = false;    uint32_t custom_colors[11];