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

Function mainGetFile

src/fe-getfile.cc:22–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

showProfilesFunction · 0.85
errorFunction · 0.85
writeToFileMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45
getFileMethod · 0.45

Tested by

no test coverage detected