aboutsummaryrefslogtreecommitdiffstats
path: root/src/actions.h
blob: 1b7ef0567bb1c7d0bb7ac28c81dd1a1fbf271f78 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* actions.h - ck actions ----------------------------------------------*- C -*-
 *
 * This file is part of ck, the config keeper
 *
 * -----------------------------------------------------------------------------
 *
 * Copyright (C) 2018  Anastasis Grammenos
 * GPLv3 (see LICENCE for the full notice)
 *
 * -----------------------------------------------------------------------------
 *
 * The various structs actions use to keep track of their
 * specific options and the run_ACTION routines.
 *
 * -------------------------------------------------------------------------- */
#ifndef ACTIONS_H
#define ACTIONS_H

#include "ckutil.h"
#include "confparser.h"

#define X(ACTION, MIN, MAX)                               \
  int run_##ACTION(UserOpt *, Conf *);
CK_ACTIONS
#undef X

enum AddOptErrors {
  ADD_NO_ERR = 0,
  ADD_ERR_WRONG_CONFIG,
  ADD_ERR_LINK_CONFIG,
  ADD_ERR_WRONG_FLAGS
};
typedef enum AddOptErrors AddOptErr;

struct AddOptions {
  char *progName;
  char confPath[STR_L];
  int secret;
  int prime;
  AddOptErr err;
};
typedef struct AddOptions AddOpt;

enum ListTypes {
  LT_PATH,
  LT_PROGRAM,
  LT_TREE,
  LT_CKCONF,
  LT_PROG_CONFS
};
typedef enum ListTypes ListType;

enum ListShowTypes {
   LST_PLAIN,
   LST_LISP,
   LST_PYTHON,
};
typedef enum ListShowTypes ListShowType;

struct ListOptions {
  ListType _lt;
  ListShowType _lst;
  char *pName;
  int attr;
  int bName;
  int err;
};
typedef struct ListOptions ListOpt;

struct EditOptions {
  char *pName;
  char *cBasename;
  char *editor;
  char *cmd;
  int sudo;
  int err;
};
typedef struct EditOptions EditOpt;

/**************/
/* PRINT HELP */
/**************/
#define X(ACTION, MIN, MAX)                        \
  void print_##ACTION##_help(void);
CK_ACTIONS
#undef X
#endif /* ACTIONS_H */