aboutsummaryrefslogtreecommitdiffstats
path: root/src/actions.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-09-20 20:09:08 +0300
committergramanas <anastasis.gramm2@gmail.com>2018-09-20 20:09:08 +0300
commit021f74591d5a99287443517c618c1ed514334986 (patch)
tree4686502f38a53821126311d610929d795cb6a6d7 /src/actions.c
parente88822fa19408316f3e15d173843169baa938aa7 (diff)
downloadck-021f74591d5a99287443517c618c1ed514334986.tar.gz
ck-021f74591d5a99287443517c618c1ed514334986.tar.bz2
ck-021f74591d5a99287443517c618c1ed514334986.zip
Add list tree support
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/actions.c b/src/actions.c
index 7d5276a..c084e8f 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -199,6 +199,9 @@ ListOpt make_list_options(cklist *args) {
else if (strcmp(list_get(args), "programs") == 0) {
listOpt._lt = LT_PROGRAM;
}
+ else if (strcmp(list_get(args), "tree") == 0) {
+ listOpt._lt = LT_TREE;
+ }
else {
listOpt.err = 1;
}
@@ -209,6 +212,7 @@ ListOpt make_list_options(cklist *args) {
}
int run_LIST(UserOpt *opt, Conf *conf) {
+ UNUSED(conf);
DB db = open_DB(opt);
if (db.ptr == NULL) {
if (db.error == SQL_ERR_NO_TABLES) {
@@ -232,6 +236,12 @@ int run_LIST(UserOpt *opt, Conf *conf) {
case LT_PROGRAM:
list_get_programs(&db, list_type);
break;
+ case LT_TREE:
+ list_get_path_program_tree(&db, list_type);
+ list_print(list_type);
+ close_DB(&db);
+ list_free(list_type);
+ return 1;
case LT_NONE:
printf("What should I list? (paths, configs)\n");
close_DB(&db);