using System;
using System.Collections.Generic;
using System.Text;
namespace Duplicati.Library.Backend
{
public class CommandLineArgument : Duplicati.Library.Backend.ICommandLineArgument
{
public enum ArgumentType
{
///
/// Indicates that the argument is a string type
///
String,
///
/// Indicates that the argument is an integer type
///
Integer,
///
/// Indicates that the argument is a boolean type
///
Boolean,
///
/// Indicates that the argument is a timespan type
///
Timespan,
///
/// Indicates that the argument is a size type
///
Size,
///
/// Indicates that the argument is an enumeration value
///
Enumeration,
///
/// Indicates that the argument is a path to a file or directory
///
Path,
///
/// The argument type is unknown
///
Unknown
}
private string m_name;
private string[] m_aliases = null;
private ArgumentType m_type = ArgumentType.Unknown;
private string[] m_validValues = null;
private string m_shortDescription = "";
private string m_longDescription = "";
private string m_defaultValue = "";
///
/// The primary name for the argument
///
public string Name
{
get { return m_name; }
set { m_name = value; }
}
///
/// A list of valid aliases, may be null or an empty array
///
public string[] Aliases
{
get { return m_aliases; }
set { m_aliases = value; }
}
///
/// The argument type
///
public ArgumentType Type
{
get { return m_type; }
set { m_type = value; }
}
///
/// A list of valid values, if applicable
///
public string[] ValidValues
{
get { return m_validValues; }
set { m_validValues = value; }
}
///
/// A short description of the argument
///
public string ShortDescription
{
get { return m_shortDescription; }
set { m_shortDescription = value; }
}
///
/// A long description of the argument
///
public string LongDescription
{
get { return m_longDescription; }
set { m_longDescription = value; }
}
///
/// Creates a new CommandLineArgument instance
///
/// The name of the argument
public CommandLineArgument(string name)
{
m_name = name;
}
///
/// Creates a new CommandLineArgument instance
///
/// The name of the argument
/// The argument type
public CommandLineArgument(string name, ArgumentType type)
: this(name)
{
m_type = type;
}
///
/// Creates a new CommandLineArgument instance
///
/// The name of the argument
/// The argument type
/// The arguments short description
/// The arguments long description
public CommandLineArgument(string name, ArgumentType type, string shortDescription, string longDescription)
: this(name, type)
{
m_shortDescription = shortDescription;
m_longDescription = longDescription;
}
///
/// Creates a new CommandLineArgument instance
///
/// The name of the argument
/// The argument type
/// The arguments short description
/// The arguments long description
/// The default value of the argumen
public CommandLineArgument(string name, ArgumentType type, string shortDescription, string longDescription, string defaultValue)
: this(name, type, shortDescription, longDescription)
{
m_defaultValue = defaultValue;
}
///
/// Creates a new CommandLineArgument instance
///
/// The name of the argument
/// The argument type
/// The arguments short description
/// The arguments long description
/// The default value of the argumen
/// A list of aliases for the command
/// A list of valid values for the command
public CommandLineArgument(string name, ArgumentType type, string shortDescription, string longDescription, string defaultValue, string[] aliases, string[] values)
: this(name, type, shortDescription, longDescription, defaultValue)
{
m_aliases = aliases;
m_validValues = values;
}
}
}