| 134 | } |
| 135 | |
| 136 | static void list_library(color_ostream &out) { |
| 137 | std::map<std::filesystem::path, bool> files; |
| 138 | if (0 < Filesystem::listdir_recursive(ORDERS_LIBRARY_DIR, files, 0, false)) { |
| 139 | // if the library directory doesn't exist, just skip it |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | if (files.empty()) { |
| 144 | // if no files in the library directory, just skip it |
| 145 | return; |
| 146 | } |
| 147 | |
| 148 | for (auto& it : files) |
| 149 | { |
| 150 | if (it.second) |
| 151 | continue; // skip directories |
| 152 | std::filesystem::path name = it.first; |
| 153 | if (name.extension() != ".json") |
| 154 | continue; // skip non-.json files |
| 155 | auto sname = name.stem(); |
| 156 | out << Filesystem::as_string("library" / sname) << std::endl; |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | static command_result orders_list_command(color_ostream & out) |
| 161 | { |
no test coverage detected