transport-helper: add trailing --
[git/dscho.git] / test-credential.c
blobdee200e7f2b636f4c4aaff438b6a9f174df31c75
1 #include "cache.h"
2 #include "credential.h"
3 #include "string-list.h"
5 static const char usage_msg[] =
6 "test-credential <fill|approve|reject> [helper...]";
8 int main(int argc, const char **argv)
10 const char *op;
11 struct credential c = CREDENTIAL_INIT;
12 int i;
14 op = argv[1];
15 if (!op)
16 usage(usage_msg);
17 for (i = 2; i < argc; i++)
18 string_list_append(&c.helpers, argv[i]);
20 if (credential_read(&c, stdin) < 0)
21 die("unable to read credential from stdin");
23 if (!strcmp(op, "fill")) {
24 credential_fill(&c);
25 if (c.username)
26 printf("username=%s\n", c.username);
27 if (c.password)
28 printf("password=%s\n", c.password);
30 else if (!strcmp(op, "approve"))
31 credential_approve(&c);
32 else if (!strcmp(op, "reject"))
33 credential_reject(&c);
34 else
35 usage(usage_msg);
37 return 0;