Skip to content

Custom Templates

Brenek Harrison edited this page Jan 6, 2021 · 2 revisions

Locations

Custom templates go in one of two places: inside a .kfftemplates folder in the root of the project directory or in the current user's home folder.

Example user home locations:

  • Windows - C:\Users\your_user\.kfftemplates
  • Linux - /home/your_user/.kfftemplates
  • MacOS - /User/your_user/.kfftemplates

Kotlin for FRC does not automatically create these folders for you, you will need to do it yourself.

Variables

There are three variables one can use in a Kotlin for FRC template:

  • #{PACKAGE} - Kotlin for FRC will replace any occurrences of this with an auto-generated package definition based on the folder the file is created in.
  • #{NAME} - Kotlin for FRC will replace any occurrences of this with the name that the user dictates when prompted.
  • #{GRADLE_RIO_VERSION} - Kotlin for FRC will replace any occurrences of this with the most up-to-date GradleRIO version for the project year at the time of file creation.

File names

All templates must have a file extension of .kfftemplate and match one of the following names based on the template to override:

  • Command Based Template Names

    • robot.kfftemplate
    • robotContainer.kfftemplate
    • constants.kfftemplate
    • command.kfftemplate
    • instantCommand.kfftemplate
    • parallelCommandGroup.kfftemplate
    • parallelDeadlineGroup.kfftemplate
    • parallelRaceGroup.kfftemplate
    • PIDCommand.kfftemplate
    • profiledPIDCommand.kfftemplate
    • sequentialCommandGroup.kfftemplate
    • trapezoidProfileCommand.kfftemplate
    • subsystem.kfftemplate
    • PIDSubsystem.kfftemplate
    • profiledPIDSubsystem.kfftemplate
    • trapezoidProfileSubsystem.kfftemplate
  • Old Command Based Templates Names

    • oldRobot.kfftemplate
    • oldOI.kfftemplate
    • oldRobotMap.kfftemplate
    • oldSubsystem.kfftemplate
    • oldCommand.kfftemplate
    • oldCommandGroup.kfftemplate
    • oldPIDSubsystem.kfftemplate
    • oldInstantCommand.kfftemplate
    • oldTimedCommand.kfftemplate
    • oldTrigger.kfftemplate
  • Miscellaneous Template Names

    • buildGradle.kfftemplate
    • emptyClass.kfftemplate
Clone this wiki locally