2016-10-27 02:13:32 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2016-11-07 21:29:30 +00:00
|
|
|
#include "ipfs/commands/argument.h"
|
2016-10-27 01:14:07 +00:00
|
|
|
|
2016-11-10 13:28:51 +00:00
|
|
|
int commands_argument_free(struct Argument* argument) {
|
2016-11-28 13:09:00 +00:00
|
|
|
free(argument);
|
2016-10-27 02:13:32 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-11-10 13:28:51 +00:00
|
|
|
int commands_argument_init(struct Argument* argument, char* name, int required, int variadic, char* description) {
|
2016-10-27 01:14:07 +00:00
|
|
|
argument->name = name;
|
|
|
|
argument->required = required;
|
|
|
|
argument->variadic = variadic;
|
|
|
|
argument->description = description;
|
2016-10-27 02:13:32 +00:00
|
|
|
return 1;
|
2016-10-27 01:14:07 +00:00
|
|
|
}
|
|
|
|
|
2016-11-10 13:28:51 +00:00
|
|
|
int commands_argument_string_init(struct Argument* argument, char* name, int required, int variadic, char* description) {
|
|
|
|
int retVal = commands_argument_init(argument, name, required, variadic, description);
|
2016-10-27 02:13:32 +00:00
|
|
|
if (retVal)
|
|
|
|
argument->type = string;
|
|
|
|
return retVal;
|
2016-10-27 01:14:07 +00:00
|
|
|
}
|
|
|
|
|
2016-11-10 13:28:51 +00:00
|
|
|
int commands_argument_file_init(struct Argument* argument, char* name, int required, int variadic, char* description) {
|
|
|
|
int retVal = commands_argument_init(argument, name, required, variadic, description);
|
2016-10-27 02:13:32 +00:00
|
|
|
if (retVal)
|
|
|
|
argument->type = file;
|
|
|
|
return retVal;
|
2016-10-27 01:14:07 +00:00
|
|
|
}
|