001/*----------------------------------------------------------------------------*/
002/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
003/* Open Source Software - may be modified and shared by FRC teams. The code   */
004/* must be accompanied by the FIRST BSD license file in the root directory of */
005/* the project.                                                               */
006/*----------------------------------------------------------------------------*/
007
008package edu.wpi.first.wpilibj.command;
009
010/**
011 * A {@link PrintCommand} is a command which prints out a string when it is initialized, and then
012 * immediately finishes. It is useful if you want a {@link CommandGroup} to print out a string when
013 * it reaches a certain point.
014 */
015public class PrintCommand extends InstantCommand {
016
017  /**
018   * The message to print out.
019   */
020  private String m_message;
021
022  /**
023   * Instantiates a {@link PrintCommand} which will print the given message when it is run.
024   *
025   * @param message the message to print
026   */
027  public PrintCommand(String message) {
028    super("Print(\"" + message + "\"");
029    m_message = message;
030  }
031
032  protected void initialize() {
033    System.out.println(m_message);
034  }
035}