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

52 lines
1,008 B
C
Raw Normal View History

2016-10-27 01:14:07 +00:00
/***
* The structures to commands
*/
#ifndef __COMMANDS_COMMAND_H__
#define __COMMANDS_COMMAND_H__
2016-11-07 21:29:30 +00:00
#include "ipfs/commands/argument.h"
//#include "ipfs/commands/request.h"
2016-10-27 18:11:34 +00:00
#include "command_option.h"
2016-10-27 01:14:07 +00:00
// forward declaration
struct Request;
2016-10-27 18:11:34 +00:00
struct HelpText {
2016-10-27 01:14:07 +00:00
char* tagline;
char* short_description;
char** synopsis_options_values;
// optional
char* usage;
char* long_description;
char* options;
char* subcommands;
char* synopsis;
};
2016-10-27 18:11:34 +00:00
struct Command {
struct CommandOption** options;
int option_count;
struct Argument** arguments;
2016-10-27 02:13:32 +00:00
int argument_count;
2016-10-27 18:11:34 +00:00
int (*pre_run)(struct Request*);
int (*run)(struct Request*);
int (*post_run)(struct Request*);
2016-10-27 01:14:07 +00:00
//struct marshaller** marshallers;
2016-10-27 18:11:34 +00:00
struct HelpText help_text;
2016-10-27 01:14:07 +00:00
// a boolean to determine if this is an external
// binary.
int external;
//struct type return_type;
char** subcommands;
};
2016-10-27 18:11:34 +00:00
// construction/destruction
int commands_command_init(struct Command* cmd);
int commands_command_free(struct Command* cmd);
2016-10-27 18:11:34 +00:00
2016-10-27 01:14:07 +00:00
#endif // command.h