codeflood logo

Custom Commands

One design goal for Revolver was to be a platform for custom tool development and allow users to create their own commands.

Defining a Command

Revolver commands must implement the Revolver.Core.Commands.ICommand, Revolver.Core interface. As a convenience commands may subclass Revolver.Core.Commands.BaseCommand, Revolver.Core which implements the interface and handles initialisation.

Command Arguments

Arguments passed to the command through the command line are automatically mapped to properties of the command class. Attributes are used to facilitate this mapping and control how it's performed.

The following attributes are supported:

Attribute Name Purpose
Revolver.Core.Commands.DescriptionAttribute Provides a description of the command which is used in the help system.
Revolver.Core.Commands.FlagParameterAttribute For boolean properties. This argument is either present or not.
Revolver.Core.Commands.ListParameterAttribute For IList<string> properties. Collects all unmatched arguments from the argument list.
Revolver.Core.Commands.NamedParameterAttribute For arguments passed by name.
Revolver.Core.Commands.NoSubstitutionAttribute Indicates token substitution should not be performed for the property.
Revolver.Core.Commands.NumberedParameterAttribute For arguments passed in order.
Revolver.Core.Commands.OptionalAttribute Indicates the argument is optional. Only used as an indicator in the help system, not enforced by the parser.


Here's a quick example of a custom command that uses automatic argument mapping.

public class MyCommand : BaseCommand
  [NumberedParameter(0, "name")]
  [Description("The name to use")]
  public string Name { get; set; }
  [Description("Changes the operation or something")]
  public bool Unclone { get; set; }
  [NamedParameter("a", "attribute")]
  [Description("Provide a something")]
  public int Attribute { get; set; }
  public override CommandResult Run()
    // implement command
  public override string Description()
    return "Description of what the command does";
  public override void Help(HelpDetails details)
    // Add help details here


The best reference available for implementing commands in Revolver would be the Revolver source itself. Have a look over the commands at