| 14 | static StringFlag newFilename({"--path2"}, "new filename", ""); |
| 15 | |
| 16 | int mainMv(int argc, const char* argv[]) |
| 17 | { |
| 18 | if (argc == 1) |
| 19 | showProfiles("mv", formats); |
| 20 | flags.parseFlagsWithConfigFiles(argc, argv, formats); |
| 21 | |
| 22 | try |
| 23 | { |
| 24 | auto filesystem = Filesystem::createFilesystemFromConfig(); |
| 25 | |
| 26 | Path oldPath(oldFilename); |
| 27 | if (oldPath.size() == 0) |
| 28 | error("old filename missing"); |
| 29 | |
| 30 | Path newPath(newFilename); |
| 31 | if (newPath.size() == 0) |
| 32 | error("new filename missing"); |
| 33 | |
| 34 | filesystem->moveFile(oldPath, newPath); |
| 35 | filesystem->flushChanges(); |
| 36 | } |
| 37 | catch (const FilesystemException& e) |
| 38 | { |
| 39 | error("{}", e.message); |
| 40 | } |
| 41 | |
| 42 | return 0; |
| 43 | } |
nothing calls this directly
no test coverage detected