2 * types.h: Library for interactive commandline interfaces
4 * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __VSC_CLI__TYPES_H__
22 #define __VSC_CLI__TYPES_H__
24 #include <libvscmisc/types.h>
30 enum VscCliOptionType {
31 VSC_CLI__OPTION_TYPE__BOOLEAN = 0,
32 VSC_CLI__OPTION_TYPE__NUMBER,
33 VSC_CLI__OPTION_TYPE__STRING,
37 struct VscCliCommandInfo;
39 typedef void (*VscCliCommandFunction) (struct VscError *error,
40 const struct VscCliCommandInfo *command_info,
41 const struct VscCliOption *option_list,
44 typedef void (*VscCliErrorFunction) (struct VscError *error,
47 typedef void (*VscCliPromptFunction) (struct VscError *error, char *prompt,
48 size_t size, void *user_data);
50 struct VscCliOptionInfo {
51 const char short_name;
52 const char* long_name;
54 enum VscCliOptionType type;
60 struct VscCliOption *next;
61 const struct VscCliOptionInfo *info;
66 struct VscCliCommandInfo {
69 const char* description;
70 VscCliCommandFunction function;
71 const struct VscCliOptionInfo *option_infos;
74 struct VscCliCommand {
75 struct VscCliCommand *next;
76 const struct VscCliCommandInfo *info;
77 struct VscCliOption *option_list;
84 #endif /* __VSC_CLI__TYPES_H__ */