aboutsummaryrefslogtreecommitdiffstats
path: root/src/actionhelper.h
blob: 3393ec3128e4faad903430a54a83773b488d1bb4 (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
/* actionhelper.h - helper functions 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)
 *
 * -----------------------------------------------------------------------------
 *
 *
 * -------------------------------------------------------------------------- */
#ifndef ACTIONHELPER_H
#define ACTIONHELPER_H

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

/*******/
/* 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);

/********/
/* EDIT */
/********/
typedef enum edit_opt_return_code edit_rc;
enum edit_opt_return_code {
  ERC_OK,
  ERC_SUGGESTIONS,
  ERC_ERR
};

extern edit_rc edit_get_config_or_suggestions(cklist* args, char *ret);

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

/*****************/
/* PRINT RESULTS */
/*****************/
#define X(ACTION)                               \
  extern void print_##ACTION##_result(int ok);
CK_ACTIONS
#undef X

#endif /* ACTIONHELPER_H */