diff --git a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java index c53409a033d..5483adaccee 100644 --- a/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java +++ b/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/Commands.java @@ -51,6 +51,18 @@ public static Command runOnce(Runnable action, Subsystem... requirements) { return new InstantCommand(action, requirements); } + /** + * Constructs a command that runs an action once and finishes. + * + * @param action the action to run + * @return the command + * @see InstantCommand + * @see Commands#runOnce(Runnable, Subsystem...) + */ + public static Command runOnce(Runnable action) { + return new InstantCommand(action); + } + /** * Constructs a command that runs an action every iteration until interrupted. * @@ -63,6 +75,18 @@ public static Command run(Runnable action, Subsystem... requirements) { return new RunCommand(action, requirements); } + /** + * Constructs a command that runs an action every iteration until interrupted. + * + * @param action the action to run + * @return the command + * @see RunCommand + * @see Commands#run(Runnable, Subsystem...) + */ + public static Command run(Runnable action) { + return new RunCommand(action); + } + /** * Constructs a command that runs an action once and another action when the command is * interrupted.