command/Partition: add command "partition" to switch to another partition
This commit is contained in:
@@ -28,6 +28,21 @@
|
||||
#include "player/Thread.hxx"
|
||||
#include "util/CharUtil.hxx"
|
||||
|
||||
CommandResult
|
||||
handle_partition(Client &client, Request request, Response &response)
|
||||
{
|
||||
const char *name = request.front();
|
||||
auto &instance = client.GetInstance();
|
||||
auto *partition = instance.FindPartition(name);
|
||||
if (partition == nullptr) {
|
||||
response.Error(ACK_ERROR_NO_EXIST, "partition does not exist");
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
|
||||
client.SetPartition(*partition);
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
CommandResult
|
||||
handle_listpartitions(Client &client, Request, Response &r)
|
||||
{
|
||||
|
Reference in New Issue
Block a user