builtin / credential.con commit Merge branch 'nd/doc-git-index-version' into maint (2217579)
   1#include "git-compat-util.h"
   2#include "credential.h"
   3#include "builtin.h"
   4
   5static const char usage_msg[] =
   6        "git credential [fill|approve|reject]";
   7
   8int cmd_credential(int argc, const char **argv, const char *prefix)
   9{
  10        const char *op;
  11        struct credential c = CREDENTIAL_INIT;
  12
  13        op = argv[1];
  14        if (!op)
  15                usage(usage_msg);
  16
  17        if (credential_read(&c, stdin) < 0)
  18                die("unable to read credential from stdin");
  19
  20        if (!strcmp(op, "fill")) {
  21                credential_fill(&c);
  22                credential_write(&c, stdout);
  23        } else if (!strcmp(op, "approve")) {
  24                credential_approve(&c);
  25        } else if (!strcmp(op, "reject")) {
  26                credential_reject(&c);
  27        } else {
  28                usage(usage_msg);
  29        }
  30        return 0;
  31}