[commands] Deprecate proxy supplier constructor (#6553)

This commit is contained in:
DeltaDizzy
2024-04-29 23:11:29 -05:00
committed by GitHub
parent c71db8ea9c
commit a9cfd0d0f9
6 changed files with 51 additions and 7 deletions

View File

@@ -5,10 +5,12 @@
#include "frc2/command/ProxyCommand.h"
#include <fmt/core.h>
#include <wpi/deprecated.h>
#include <wpi/sendable/SendableBuilder.h>
using namespace frc2;
WPI_IGNORE_DEPRECATED
ProxyCommand::ProxyCommand(wpi::unique_function<Command*()> supplier)
: m_supplier(std::move(supplier)) {}
@@ -18,9 +20,10 @@ ProxyCommand::ProxyCommand(wpi::unique_function<CommandPtr()> supplier)
holder = supplier();
return holder->get();
}) {}
WPI_UNIGNORE_DEPRECATED
ProxyCommand::ProxyCommand(Command* command)
: ProxyCommand([command] { return command; }) {
: m_supplier([command] { return command; }) {
SetName(fmt::format("Proxy({})", command->GetName()));
}