WIP
This commit is contained in:
parent
99ae7f2236
commit
7d042fa5bd
5 changed files with 9406 additions and 0 deletions
57
tools/archive/main.cpp
Normal file
57
tools/archive/main.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
|
||||
#include <Spectre/System/File.h>
|
||||
#include <CLI11/CLI.hpp>
|
||||
#include <iostream>
|
||||
#include "archive.h"
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
Archive arch;
|
||||
|
||||
std::string filename;
|
||||
std::string directory;
|
||||
|
||||
CLI::App app("Pack archive files");
|
||||
|
||||
app.add_option("file", filename, "file name")->required();
|
||||
|
||||
CLI::App *read = app.add_subcommand("read", "Read files");
|
||||
CLI::App *write = app.add_subcommand("write", "Write files");
|
||||
app.require_subcommand();
|
||||
|
||||
//app.add_option("directory", directory, "directory")->required();
|
||||
|
||||
CLI11_PARSE(app, argc, argv);
|
||||
|
||||
std::cout << filename << std::endl;
|
||||
|
||||
if (read->parsed()) {
|
||||
|
||||
arch.read(filename);
|
||||
|
||||
for (auto idx : arch.files()) {
|
||||
std::string str;
|
||||
str.assign(idx.second.begin(), idx.second.end());
|
||||
|
||||
std::cout << idx.first << ": " << str << std::endl;
|
||||
}
|
||||
|
||||
} else {
|
||||
std::string str = "Hello";
|
||||
std::vector<uint8_t> data;
|
||||
|
||||
data.assign(str.begin(), str.end());
|
||||
arch.add("some/path", data);
|
||||
|
||||
std::string str2 = "Hello Again";
|
||||
std::vector<uint8_t> data2;
|
||||
data2.assign(str2.begin(), str2.end());
|
||||
|
||||
arch.add("some/other/path", data2);
|
||||
|
||||
arch.write(filename);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue