Merge branch 'bw/doc-repo-layout' into next
[git] / credential-getpass.c
1 #include "cache.h"
2 #include "credential.h"
3 #include "parse-options.h"
4 #include "string-list.h"
5
6 int main(int argc, const char **argv)
7 {
8         const char * const usage[] = {
9                 "git credential-getpass [options]",
10                 NULL
11         };
12         struct credential c = { NULL };
13         int reject = 0;
14         struct option options[] = {
15                 OPT_BOOLEAN(0, "reject", &reject,
16                             "reject a stored credential"),
17                 OPT_STRING(0, "username", &c.username, "name",
18                            "an existing username"),
19                 OPT_STRING(0, "description", &c.description, "desc",
20                            "human-readable description of the credential"),
21                 OPT_STRING(0, "unique", &c.unique, "token",
22                            "a unique context for the credential"),
23                 OPT_END()
24         };
25
26         argc = parse_options(argc, argv, NULL, options, usage, 0);
27         if (argc)
28                 usage_with_options(usage, options);
29
30         if (reject)
31                 return 0;
32
33         credential_getpass(&c);
34         printf("username=%s\n", c.username);
35         printf("password=%s\n", c.password);
36         return 0;
37 }