aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-10-19 13:06:27 +0300
committergramanas <anastasis.gramm2@gmail.com>2018-10-19 13:06:27 +0300
commit18e6099230c3bfe23d4faeeae289554f127deb87 (patch)
treee395857e93a6f40a801aa97c8fd4e9349c72e824 /src
parent147efc35461763c38e8875afac7bc44d2559204b (diff)
downloadck-18e6099230c3bfe23d4faeeae289554f127deb87.tar.gz
ck-18e6099230c3bfe23d4faeeae289554f127deb87.tar.bz2
ck-18e6099230c3bfe23d4faeeae289554f127deb87.zip
Add install script and config/verbose help
Diffstat (limited to 'src')
-rw-r--r--src/actionhelper.c21
-rw-r--r--src/actionhelper.h3
-rw-r--r--src/actionparser.c2
-rw-r--r--src/actions.c10
4 files changed, 35 insertions, 1 deletions
diff --git a/src/actionhelper.c b/src/actionhelper.c
index 6507e7b..6e76b2b 100644
--- a/src/actionhelper.c
+++ b/src/actionhelper.c
@@ -398,3 +398,24 @@ void print_HELP_help() {
ckhelp("Note:\nRunning ck without arguments will print all the available actions.");
report_help();
}
+
+void print_conf_help(void) {
+ ckhelp("Set a different ck configuration directory.\n");
+ ckhelp("This has to be passed before any action or action argument");
+ ckhelp("and after verbose (if set).\n");
+ ckhelp("Usage:");
+ ckhelp(" ck -c /path/to/conf ...");
+ ckhelp(" ck config /path/to/conf ...\n");
+ ckhelp("ck will use the database and config file in the path supplied");
+ ckhelp("to perform any actions.\n");
+ ckhelp("Tip:\nYou can alias `ck -c /path/to/conf` and use the new alias");
+ ckhelp("to organise a different set of configurations, or some custom scrpits.");
+ report_help();
+}
+
+void print_verbose_help(void) {
+ ckhelp("WIP\n");
+ ckhelp("Currently passing the verbose flag, prints a log of what ck is doing");
+ ckhelp("during excecution of an action.");
+ report_help();
+}
diff --git a/src/actionhelper.h b/src/actionhelper.h
index eb544ce..bfe0b85 100644
--- a/src/actionhelper.h
+++ b/src/actionhelper.h
@@ -62,4 +62,7 @@ extern ListOpt list_make_options(cklist *args);
CK_ACTIONS
#undef X
+extern void print_conf_help(void);
+extern void print_verbose_help(void);
+
#endif /* ACTIONHELPER_H */
diff --git a/src/actionparser.c b/src/actionparser.c
index aee9732..7ee46fe 100644
--- a/src/actionparser.c
+++ b/src/actionparser.c
@@ -24,7 +24,7 @@ const char* const strEDIT[] = {"3", "edit", "e", "-e"};
const char* const strLIST[] = {"5", "list", "ls", "l", "-l", "-ls"};
const char* const strSEARCH[] = {"4", "search", "grep", "s", "-s"};
const char* const strHELP[] = {"5", "help", "h", "-?", "-h", "--help"};
-const char* const strConfDir[] = {"4", "config", "conf", "c", "-c"};
+const char* const strConfDir[] = {"2", "config", "-c"};
const char* const strVersion[] = {"2", "version", "--version"};
const char* const strVerbose1[] = {"2", "--verbose", "-v"};
const char* const strVerbose2[] = {"2", "--Verbose", "-V"};
diff --git a/src/actions.c b/src/actions.c
index 417f9ce..fcdf308 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -281,6 +281,16 @@ int run_HELP(UserOpt *opt, Conf *conf) {
return 0;
}
+ if (strcmp(list_get(opt->args), "config") == 0) {
+ print_conf_help();
+ return 0;
+ }
+
+ if (strcmp(list_get(opt->args), "verbose") == 0) {
+ print_verbose_help();
+ return 0;
+ }
+
switch(parser_get_action(list_get(opt->args), NULL)) {
#define X(ACTION) \
case CKA_##ACTION: \