initial commit
This commit is contained in:
115
src/capture.c
Normal file
115
src/capture.c
Normal file
@@ -0,0 +1,115 @@
|
||||
#include "commands.h"
|
||||
|
||||
#include <blue/cmd.h>
|
||||
|
||||
#define BUFFER_SIZE 65536
|
||||
|
||||
enum {
|
||||
OPT_OUTPATH,
|
||||
OPT_OUTPATH_PATH,
|
||||
|
||||
ARG_DIRECTORY,
|
||||
|
||||
OPT_TAGGED_DIRECTORY,
|
||||
OPT_TAGGED_DIRECTORY_TAG,
|
||||
OPT_TAGGED_DIRECTORY_PATH,
|
||||
|
||||
OPT_VERBOSE,
|
||||
};
|
||||
|
||||
static int capture(
|
||||
const b_command *self,
|
||||
const b_arglist *opt,
|
||||
const b_array *args)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
B_COMMAND(CMD_CAPTURE, CMD_ROOT)
|
||||
{
|
||||
B_COMMAND_NAME("capture");
|
||||
B_COMMAND_SHORT_NAME('Z');
|
||||
B_COMMAND_DESC(
|
||||
"capture one or more directories into an ec3 container. each "
|
||||
"directory specified will be stored in a separate volume "
|
||||
"within "
|
||||
"the created container.");
|
||||
B_COMMAND_FLAGS(B_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
B_COMMAND_FUNCTION(capture);
|
||||
|
||||
B_COMMAND_HELP_OPTION();
|
||||
|
||||
B_COMMAND_OPTION(OPT_OUTPATH)
|
||||
{
|
||||
B_OPTION_SHORT_NAME('o');
|
||||
B_OPTION_LONG_NAME("out");
|
||||
B_OPTION_DESC("the path to save the new file to.");
|
||||
|
||||
B_OPTION_ARG(OPT_OUTPATH_PATH)
|
||||
{
|
||||
B_ARG_NAME("path");
|
||||
B_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
B_COMMAND_ARG(ARG_DIRECTORY)
|
||||
{
|
||||
B_ARG_NAME("directory");
|
||||
B_ARG_DESC(
|
||||
"a directory to add to the container. a volume "
|
||||
"will be created "
|
||||
"within the container to store the specified "
|
||||
"directory.");
|
||||
|
||||
B_ARG_NR_VALUES(B_ARG_1_OR_MORE_VALUES);
|
||||
}
|
||||
|
||||
B_COMMAND_OPTION(OPT_TAGGED_DIRECTORY)
|
||||
{
|
||||
B_OPTION_SHORT_NAME('D');
|
||||
B_OPTION_LONG_NAME("tagged-directory");
|
||||
B_OPTION_DESC(
|
||||
"a file to add to the container, with an associated "
|
||||
"tag. a disk "
|
||||
"image will be created within the container to store "
|
||||
"the specified "
|
||||
"directory. the tag must be either: (a) a 64-bit "
|
||||
"hexadecimal "
|
||||
"number; or (b) a string of no more than 8 "
|
||||
"characters.");
|
||||
|
||||
B_OPTION_ARG(OPT_TAGGED_DIRECTORY_TAG)
|
||||
{
|
||||
B_ARG_NAME("tag");
|
||||
B_ARG_NR_VALUES(1);
|
||||
}
|
||||
|
||||
B_OPTION_ARG(OPT_TAGGED_DIRECTORY_PATH)
|
||||
{
|
||||
B_ARG_NAME("path");
|
||||
B_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
B_COMMAND_OPTION(OPT_VERBOSE)
|
||||
{
|
||||
B_OPTION_SHORT_NAME('v');
|
||||
B_OPTION_LONG_NAME("verbose");
|
||||
B_OPTION_DESC(
|
||||
"show detailed output logs. this option can be "
|
||||
"specified multiple "
|
||||
"times to increase the level of output.");
|
||||
}
|
||||
|
||||
B_COMMAND_USAGE()
|
||||
{
|
||||
B_COMMAND_USAGE_OPT(OPT_OUTPATH);
|
||||
B_COMMAND_USAGE_ARG(ARG_DIRECTORY);
|
||||
}
|
||||
|
||||
B_COMMAND_USAGE()
|
||||
{
|
||||
B_COMMAND_USAGE_OPT(OPT_OUTPATH);
|
||||
B_COMMAND_USAGE_OPT(OPT_TAGGED_DIRECTORY);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user