]> oss.titaniummirror.com Git - repo_shell.git/commitdiff
Add help option, expand test option to normal and detail
authorR. Steve McKown <rsmckown@gmail.com>
Fri, 28 Sep 2012 18:47:33 +0000 (12:47 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Fri, 28 Sep 2012 19:15:57 +0000 (13:15 -0600)
repo_shell.c

index 4a6dd2b0e8c257a284f52c8162092d55a1f104ad..7d34e576e7e122782ed7eef5229eef23b82f18c2 100644 (file)
@@ -179,6 +179,17 @@ int main(int argc, char **argv)
     die("opening /dev/null failed");
   close (devnull_fd);
 
+  if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) {
+    fprintf(stderr, "%s is a replacement login shell.\n"
+        "  May be ran from the command line with one of these options:\n"
+        "    -h|--help                 this text\n"
+        "    -v|--version              program version string\n"
+        "    -t|--test <user> <repo>   test access\n"
+        "    -d|--detail <user> <repo> test access, outputting more detail\n"
+        , argv[0]);
+    return 0;
+  }
+
   if (argc == 2 && (!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version"))) {
     fprintf(stderr, "%s\n", version);
     return 0;
@@ -200,11 +211,11 @@ int main(int argc, char **argv)
     return 1;
   }
 
-  if ((!strcmp(argv[1], "-t") || !strcmp(argv[1], "--test"))) {
+  if ((!strcmp(argv[1], "-d") || !strcmp(argv[1], "--detail"))) {
     perms_t p;
 
     if (argc !=4)
-      die("usage: %s -t|--test <user> <repo>", argv[0]);
+      die("usage: %s -d|--detail <user> <repo>", argv[0]);
     p = git_acl(argv[2], argv[3], cfg.git_acl_file);
     fprintf(stderr,
         "user '%s' repo '%s' perms '%s'\n  via userid '%s' repoid '%s'\n",
@@ -213,11 +224,11 @@ int main(int argc, char **argv)
     return 0;
   }
 
-  if ((!strcmp(argv[1], "-c") || !strcmp(argv[1], "--check"))) {
+  if ((!strcmp(argv[1], "-t") || !strcmp(argv[1], "--test"))) {
     perms_t p;
 
     if (argc !=4)
-      die("usage: %s -c|--check <user> <repo>", argv[0]);
+      die("usage: %s -t|--test <user> <repo>", argv[0]);
     p = git_acl(argv[2], argv[3], cfg.git_acl_file);
     printf("%s\n", git_acl_perms_as_str(p));
     return 0;