http-fetch: make `-a` standard behaviour
[git/debian.git] / builtin / credential.c
blob879acfbcda75141d3022e9b285e191977a06ba3d
1 #include "git-compat-util.h"
2 #include "credential.h"
3 #include "builtin.h"
5 static const char usage_msg[] =
6 "git credential [fill|approve|reject]";
8 int cmd_credential(int argc, const char **argv, const char *prefix)
10 const char *op;
11 struct credential c = CREDENTIAL_INIT;
13 if (argc != 2 || !strcmp(argv[1], "-h"))
14 usage(usage_msg);
15 op = argv[1];
17 if (credential_read(&c, stdin) < 0)
18 die("unable to read credential from stdin");
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);
30 return 0;