aboutsummaryrefslogtreecommitdiffstats
path: root/src/actionhelper.h
blob: 426569105620a3b772227c72ada5533eedda66a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* actionhelper.h - helper routines for ck actions --------------------*- C -*-
 *
 * This file is part of ck, the config keeper
 *
 * -----------------------------------------------------------------------------
 *
 * Copyright (C) 2018  Anastasis Grammenos
 * GPLv3 (see LICENCE for the full notice)
 *
 * -----------------------------------------------------------------------------
 *
 * Here reside helper routines for the actions.
 *
 * -------------------------------------------------------------------------- */
#ifndef ACTIONHELPER_H
#define ACTIONHELPER_H

#include "actions.h"
#include "ckutil.h"
#include "cklist.h"
#include "dblayer.h"

/********/
/* INIT */
/********/

extern int init_create_config_file(UserOpt *opt);

/*******/
/* ADD */
/*******/

/* if add_err is set, return true
 * along with a copy of the error message.
 * Pass NULL if you don't care about the message */
extern int add_err_message(char *err);
extern AddOpt add_make_options(cklist *args);
extern void add_print_opts(AddOpt *opt);
extern void add_make_link(const AddOpt *opt, const Conf *conf);

/*******/
/* DEL */
/*******/
extern DelOpt del_make_options(cklist *args);

/********/
/* EDIT */
/********/
extern void edit_print_suggested_configs(DB *db, const char *pName);

/********/
/* LIST */
/********/
extern ListOpt list_make_options(cklist *args);

/***********/
/* RESTORE */
/***********/
extern int restore_make_links(cklist *from, cklist *to);

/************************/
/* PRINT RESULTS & HELP */
/************************/
#define X(ACTION)                               \
  extern void print_##ACTION##_result(int err); \
  extern void print_##ACTION##_help(void);
CK_ACTIONS
#undef X

extern void print_conf_help(void);
extern void print_verbose_help(void);

#endif /* ACTIONHELPER_H */