adjusted makefiles, generating config file for new ipfs repository
This commit is contained in:
parent
8d82e8235b
commit
32d187faa4
26 changed files with 276 additions and 79 deletions
|
@ -11,13 +11,13 @@
|
|||
* @param command the struct to fill
|
||||
* @returns 0 on failure, otherwise 1
|
||||
*/
|
||||
int get_init_command(struct Command* command);
|
||||
int ipfs_cmd_ipfs_init_command_new(struct Command* command);
|
||||
|
||||
/***
|
||||
* Uninitializes all the dynamic memory caused by get_init_command
|
||||
* @param command the struct
|
||||
* @returns 0 on failure, otherwise 1
|
||||
*/
|
||||
int uninit_command(struct Command* command);
|
||||
int ipfs_cmd_ipfs_init_command_free(struct Command* command);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,9 +14,41 @@ struct Argument {
|
|||
int enable_stdin;
|
||||
};
|
||||
|
||||
int init_argument(struct Argument* argument, char* name, int required, int variadic, char* description);
|
||||
int uninit_argument(struct Argument* argument);
|
||||
int init_string_argument(struct Argument* argument, char* name, int required, int variadic, char* description);
|
||||
int init_file_argument(struct Argument* argument, char* name, int required, int variadic, char* description);
|
||||
/**
|
||||
* 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);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,9 +6,12 @@
|
|||
#define __COMMANDS_COMMAND_H__
|
||||
|
||||
#include "ipfs/commands/argument.h"
|
||||
#include "ipfs/commands/request.h"
|
||||
//#include "ipfs/commands/request.h"
|
||||
#include "command_option.h"
|
||||
|
||||
// forward declaration
|
||||
struct Request;
|
||||
|
||||
struct HelpText {
|
||||
char* tagline;
|
||||
char* short_description;
|
||||
|
@ -42,7 +45,7 @@ struct Command {
|
|||
};
|
||||
|
||||
// construction/destruction
|
||||
int init_command(struct Command* cmd);
|
||||
int uninit_command(struct Command* cmd);
|
||||
int commands_command_init(struct Command* cmd);
|
||||
int commands_command_free(struct Command* cmd);
|
||||
|
||||
#endif // command.h
|
||||
|
|
|
@ -25,9 +25,19 @@ struct CommandOption {
|
|||
char* default_string_val;
|
||||
};
|
||||
|
||||
// constructors
|
||||
int init_command_option(struct CommandOption* option, char* description);
|
||||
// destructors
|
||||
int uninit_option(struct CommandOption* option);
|
||||
/***
|
||||
* Allocate the resources needed for a command option
|
||||
* @param option the CommandOption to initialize
|
||||
* @param description a description of this CommandOption
|
||||
* @returns true(1) on success
|
||||
*/
|
||||
int commands_command_option_init(struct CommandOption* option, char* description);
|
||||
|
||||
/***
|
||||
* Cleans up the resources of a CommandOption
|
||||
* @param option the CommandOption to clean up
|
||||
* @returns true(1)
|
||||
*/
|
||||
int commands_command_option_free(struct CommandOption* option);
|
||||
|
||||
#endif /* option_h */
|
||||
|
|
|
@ -17,7 +17,7 @@ struct Request {
|
|||
//optmap options;
|
||||
char* arguments;
|
||||
//file[] files;
|
||||
struct Command* cmd;
|
||||
struct Command cmd;
|
||||
struct Context* invoc_context;
|
||||
//context rctx;
|
||||
//map[string]Option optionDefs;
|
||||
|
|
|
@ -21,4 +21,11 @@ struct Identity {
|
|||
*/
|
||||
int repo_config_identity_new(struct Identity* identity, unsigned long num_bits_for_keypair);
|
||||
|
||||
/***
|
||||
* Frees resources held by Identity
|
||||
* @param identity the identity that we're cleaning up
|
||||
* @returns true(0)
|
||||
*/
|
||||
int repo_config_identity_free(struct Identity* identity);
|
||||
|
||||
#endif /* identity_h */
|
||||
|
|
|
@ -42,5 +42,13 @@ int fs_repo_is_initialized(char* repo_path);
|
|||
*/
|
||||
int fs_repo_write_config_file(char* path, struct RepoConfig* config);
|
||||
|
||||
/**
|
||||
* Initializes a new FSRepo at the given path with the provided config
|
||||
* @param repo_path the path to use
|
||||
* @param config the information for the config file
|
||||
* @returns true(1) on success
|
||||
*/
|
||||
int fs_repo_init(char* repo_path, struct RepoConfig* config);
|
||||
|
||||
|
||||
#endif /* fs_repo_h */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue