| 158 | } |
| 159 | |
| 160 | static command_result orders_list_command(color_ostream & out) |
| 161 | { |
| 162 | // use listdir_recursive instead of listdir even though orders doesn't |
| 163 | // support subdirs so we can identify and ignore subdirs with ".json" names. |
| 164 | // also listdir_recursive will alphabetize the list for us. |
| 165 | std::map<std::filesystem::path, bool> files; |
| 166 | Filesystem::listdir_recursive(ORDERS_DIR, files, 0, false); |
| 167 | |
| 168 | for (auto& it : files) { |
| 169 | if (it.second) |
| 170 | continue; // skip directories |
| 171 | std::filesystem::path name = it.first; |
| 172 | if (name.extension() != ".json") |
| 173 | continue; // skip non-.json files |
| 174 | auto sname = name.stem(); |
| 175 | out << sname.string() << std::endl; |
| 176 | } |
| 177 | |
| 178 | list_library(out); |
| 179 | |
| 180 | return CR_OK; |
| 181 | } |
| 182 | |
| 183 | static bool is_safe_filename(color_ostream & out, const std::string & name) |
| 184 | { |
no test coverage detected