MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / mainPutFile

Function mainPutFile

src/fe-putfile.cc:23–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21static StringFlag input({"-l", "--local"}, "local filename to read from", "");
22
23int mainPutFile(int argc, const char* argv[])
24{
25 if (argc == 1)
26 showProfiles("putfile", formats);
27 flags.parseFlagsWithConfigFiles(argc, argv, formats);
28
29 try
30 {
31 std::string inputFilename = input;
32 if (inputFilename.empty())
33 error("you must supply a local file to read from");
34
35 Path outputFilename(path);
36 if (outputFilename.size() == 0)
37 error("you must supply a destination path to write to");
38
39 auto data = Bytes::readFromFile(inputFilename);
40 auto filesystem = Filesystem::createFilesystemFromConfig();
41 filesystem->putFile(outputFilename, data);
42 filesystem->flushChanges();
43 }
44 catch (const FilesystemException& e)
45 {
46 error("{}", e.message);
47 }
48
49 return 0;
50}

Callers

nothing calls this directly

Calls 7

showProfilesFunction · 0.85
errorFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45
putFileMethod · 0.45
flushChangesMethod · 0.45

Tested by

no test coverage detected