| 20 | static StringFlag output({"-l", "--local"}, "local filename to write to", ""); |
| 21 | |
| 22 | int 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 | } |
nothing calls this directly
no test coverage detected