c-ipfs/include/ipfs/commands/argument.h

55 lines
1.8 KiB
C
Raw Permalink Normal View History

2016-10-27 01:14:07 +00:00
#ifndef __COMMANDS_ARGUMENT_H__
#define __COMMANDS_ARGUMENT_H__
2016-10-27 18:11:34 +00:00
enum ArgumentType { string, file };
2016-10-27 01:14:07 +00:00
2016-10-27 18:11:34 +00:00
struct Argument {
2016-10-27 01:14:07 +00:00
char* name;
2016-10-27 18:11:34 +00:00
enum ArgumentType type;
2016-10-27 01:14:07 +00:00
int required;
int variadic;
int supports_stdin;
int recursive;
char* description;
int enable_stdin;
};
/**
* Initialize an argument structure
* @param argument the structure to initialize
* @param name the name of the argument
* @param required true(1) if the argument is required
* @param variadic true(1) if the argument is variadic
* @param description the description of the argument
* @returns true(1) if all went okay
*/
int commands_argument_init(struct Argument* argument, char* name, int required, int variadic, char* description);
/***
* Free resources caused by init of argument
* @param argument the structure to clean up
* @returns true(1)
*/
int commands_argument_free(struct Argument* argument);
/***
* initializes a string type argument
* @param argument the structure to initialize
* @param name the name of the argument
* @param required true(1) if the argument is required
* @param variadic true(1) if the argument is variadic
* @param description the description of the argument
* @returns true(1) if all went okay
*/
int commands_argument_string_init(struct Argument* argument, char* name, int required, int variadic, char* description);
/***
* initializes a file type argument
* @param argument the structure to initialize
* @param name the name of the argument
* @param required true(1) if the argument is required
* @param variadic true(1) if the argument is variadic
* @param description the description of the argument
* @returns true(1) if all went okay
*/
int commands_argument_file_init(struct Argument* argument, char* name, int required, int variadic, char* description);
2016-10-27 01:14:07 +00:00
#endif