diff options
author | sinanmohd <sinan@sinanmohd.com> | 2023-12-27 16:05:41 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2023-12-29 23:22:06 +0530 |
commit | 438ad16d03f38e0e444f6ad575078ee949679a86 (patch) | |
tree | 0688901d51b9b1736679ac92af5a4636d2553bed /pass.c |
repo: init
Diffstat (limited to 'pass.c')
-rw-r--r-- | pass.c | 52 |
1 files changed, 52 insertions, 0 deletions
@@ -0,0 +1,52 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#include "pass_util.h" +#include "util.h" + +void print_usage(void); + +void print_usage(void) +{ + printf("Usage: pass COMMAND\n\n" + + "Commands:\n" + " init key-id/fingerprint\n" + " Initialize new password storage\n" + " ls [ pass-path ]\n" + " List passwords\n" + " rm pass-name\n" + " Remove password\n" + " add pass-name\n" + " Add new password\n" + " gen pass-name\n" + " Generate new password\n" + " cat pass-name\n" + " Show encrypted password\n" + " help\n" + " Show this help\n"); +} + +int main(int argc, char *argv[]) +{ + int r = 0; + + if (!--argc) { + print_usage(); + exit(EXIT_FAILURE); + } + ++argv; + + + if (!strcmp("help", *argv)) { + print_usage(); + } else if (!strcmp("init", *argv)) { + if (!argv[1]) + err_die("invalid usage, try pass help"); + + r = pass_init(argv[1]); + } + + return r; +} |