1 #include "git-compat-util.h"
2 #include "credential.h"
6 static const char usage_msg
[] =
7 "git credential (fill|approve|reject)";
9 int cmd_credential(int argc
, const char **argv
, const char *prefix UNUSED
)
12 struct credential c
= CREDENTIAL_INIT
;
14 git_config(git_default_config
, NULL
);
16 if (argc
!= 2 || !strcmp(argv
[1], "-h"))
20 if (credential_read(&c
, stdin
, CREDENTIAL_OP_INITIAL
) < 0)
21 die("unable to read credential from stdin");
23 if (!strcmp(op
, "fill")) {
24 credential_fill(&c
, 0);
25 credential_next_state(&c
);
26 credential_write(&c
, stdout
, CREDENTIAL_OP_RESPONSE
);
27 } else if (!strcmp(op
, "approve")) {
28 credential_set_all_capabilities(&c
, CREDENTIAL_OP_HELPER
);
29 credential_approve(&c
);
30 } else if (!strcmp(op
, "reject")) {
31 credential_set_all_capabilities(&c
, CREDENTIAL_OP_HELPER
);
32 credential_reject(&c
);