Skip to content

Commit

Permalink
feat: 优化PiCli交互
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Feb 22, 2024
1 parent f157fd5 commit 9f6a88b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion source/MaaProjectInterfaceCli/interactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,14 @@ void Interactor::print_config() const

void Interactor::welcome() const
{
std::cout << "Welcome to use Maa Project Interface CLI!\n\n";
if (config_.interface_data().message.empty()) {
std::cout << "Welcome to use Maa Project Interface CLI!\n\n";
}
else {
std::cout << MaaNS::utf8_to_crt(config_.interface_data().message) << "\n\n";
}

std::cout << "Version: " << MaaNS::utf8_to_crt(config_.interface_data().version) << "\n\n";
}

bool Interactor::interact_once()
Expand Down
2 changes: 1 addition & 1 deletion source/ProjectInterface/Parser/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ std::optional<InterfaceData> Parser::parse_interface(const json::value& json)
}
}
}

LogInfo << "Interface Version:" << VAR(data.version);
return data;
}

Expand Down
5 changes: 4 additions & 1 deletion source/include/ProjectInterface/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ struct InterfaceData
std::unordered_map<std::string, Option> option;
std::unordered_map<std::string, Executor> recognizer;
std::unordered_map<std::string, Executor> action;
std::string version;
std::string message;

MEO_JSONIZATION(MEO_OPT controller, resource, task, MEO_OPT option, MEO_OPT recognizer, MEO_OPT action);
MEO_JSONIZATION(MEO_OPT controller, resource, task, MEO_OPT option, MEO_OPT recognizer, MEO_OPT action,
MEO_OPT version, MEO_OPT message);
};

struct Configuration
Expand Down

0 comments on commit 9f6a88b

Please sign in to comment.