]>
Commit | Line | Data |
---|---|---|
e30b2feb | 1 | #include "git-compat-util.h" |
abca927d | 2 | #include "credential.h" |
e30b2feb | 3 | #include "builtin.h" |
abca927d JK |
4 | |
5 | static const char usage_msg[] = | |
e30b2feb | 6 | "git credential [fill|approve|reject]"; |
abca927d | 7 | |
e30b2feb | 8 | int cmd_credential(int argc, const char **argv, const char *prefix) |
abca927d JK |
9 | { |
10 | const char *op; | |
11 | struct credential c = CREDENTIAL_INIT; | |
abca927d JK |
12 | |
13 | op = argv[1]; | |
14 | if (!op) | |
15 | usage(usage_msg); | |
abca927d JK |
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); | |
2d6dc182 | 22 | credential_write(&c, stdout); |
e30b2feb | 23 | } else if (!strcmp(op, "approve")) { |
abca927d | 24 | credential_approve(&c); |
e30b2feb | 25 | } else if (!strcmp(op, "reject")) { |
abca927d | 26 | credential_reject(&c); |
e30b2feb | 27 | } else { |
abca927d | 28 | usage(usage_msg); |
e30b2feb | 29 | } |
abca927d JK |
30 | return 0; |
31 | } |