| 14 | #include <iostream> |
| 15 | |
| 16 | bool LuaFormat::Reformat(const FormatContext &context) { |
| 17 | switch (context.GetWorkMode()) { |
| 18 | case WorkMode::File: |
| 19 | case WorkMode::Stdin: { |
| 20 | auto outPath = context.GetOutputPath(); |
| 21 | auto text = context.GetInputText(); |
| 22 | auto inputPath = context.GetInputPath(); |
| 23 | auto style = context.GetStyle(inputPath); |
| 24 | return ReformatSingleFile(context, outPath, std::move(text), style); |
| 25 | } |
| 26 | case WorkMode::Workspace: { |
| 27 | return ReformatWorkspace(context); |
| 28 | } |
| 29 | } |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | bool LuaFormat::ReformatSingleFile(const FormatContext &context, std::string_view outPath, std::string &&sourceText, LuaStyle style) { |
| 34 | auto file = LuaSource::From(std::move(sourceText)); |
no test coverage detected