Git.pm: Use stream-like writing in cat_blob()
[git/dscho.git] / credential-getpass.c
blob6bfb8f8c72136805a03e8ae12d9cfa9cc1135f26
1 #include "cache.h"
2 #include "credential.h"
3 #include "parse-options.h"
4 #include "string-list.h"
6 int main(int argc, const char **argv)
8 const char * const usage[] = {
9 "git credential-getpass [options]",
10 NULL
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()
26 argc = parse_options(argc, argv, NULL, options, usage, 0);
27 if (argc)
28 usage_with_options(usage, options);
30 if (reject)
31 return 0;
33 credential_getpass(&c);
34 printf("username=%s\n", c.username);
35 printf("password=%s\n", c.password);
36 return 0;