Argument Class

Summary

Represents a command-line argument.
Assembly
NAnt.Core.dll
Namespace
NAnt.Core.Types
Interfaces
Base Types
graph BT Type-->Base0["Element"] click Base0 "/api/NAnt.Core/Element" Base0-->Base1["Object"] Type-.->Interface0["IConditional"] click Interface0 "/api/NAnt.Core/IConditional" Type["Argument"] class Type type-node

Syntax

[Serializable]
[ElementName("arg")]
public class Argument : Element, IConditional

Examples

A single command-line argument containing a space character.

<arg value="-l -a" />

Two separate command-line arguments.

<arg line="-l -a" />

A single command-line argument with the value \dir;\dir2;\dir3 on DOS-based systems and /dir:/dir2:/dir3 on Unix-like systems.

<arg path="/dir;/dir2:\dir3" />

Remarks

When passed to an external application, the argument will be quoted when appropriate. This does not apply to the NAnt.Core.Types.Argument.Line parameter, which is always passed as is.

Attributes

Type Description
SerializableAttribute
ElementNameAttribute Indicates that class should be treated as a NAnt element.

Constructors

Name Summary
Argument() Initializes a new instance of the NAnt.Core.Types.Argument class.
Argument(FileInfo) Initializes a new instance of the NAnt.Core.Types.Argument class with the given file.
Argument(PathSet) Initializes a new instance of the NAnt.Core.Types.Argument class with the given path.
Argument(string) Initializes a new instance of the NAnt.Core.Types.Argument class with the specified command-line argument.

Properties

Name Value Summary
CustomXmlProcessing bool
Gets a value indicating whether the element is performing additional processing using the NAnt.Core.Element.XmlNode that was used to initialize the element.
Inherited from Element
Directory DirectoryInfo
The value for a directory-based command-line argument; will be replaced with the absolute path of the directory.
File FileInfo
The name of a file as a single command-line argument; will be replaced with the absolute filename of the file.
IfDefined bool
Indicates if the argument should be passed to the external program. If true then the argument will be passed; otherwise, skipped. The default is true.
Line string
List of command-line arguments; will be passed to the executable as is.
Location Location
Gets or sets the location in the build file where the element is defined.
Inherited from Element
Name string
Gets the name of the XML element used to initialize this element.
Inherited from Element
NamespaceManager XmlNamespaceManager
Gets or sets the System.Xml.XmlNamespaceManager.
Inherited from Element
Parent Object
Gets or sets the parent of the element.
Inherited from Element
Path PathSet
The value for a PATH-like command-line argument; you can use : or ; as path separators and NAnt will convert it to the platform's local conventions, while resolving references to environment variables.
PathSet PathSet
Sets a single command-line argument and treats it like a PATH - ensures the right separator for the local platform is used.
Project Project
Gets or sets the NAnt.Core.Element.Project to which this element belongs.
Inherited from Element
Properties PropertyDictionary
Gets the properties local to this NAnt.Core.Element and the NAnt.Core.Element.Project.
Inherited from Element
UnlessDefined bool
Indicates if the argument should not be passed to the external program. If false then the argument will be passed; otherwise, skipped. The default is false.
Value string
A single command-line argument; can contain space characters.
XmlNode XmlNode
Gets or sets the XML node of the element.
Inherited from Element

Methods

Name Value Summary
CopyTo(Element) void
Copies all instance data of the NAnt.Core.Element to a given NAnt.Core.Element.
Inherited from Element
GetAttributeConfigurationNode(FrameworkInfo, string) XmlNode
Locates the XML node for the specified attribute in the project configuration node.
Inherited from Element
GetAttributeConfigurationNode(XmlNode, FrameworkInfo, string) XmlNode
Inherited from Element
GetLocation() Location
Retrieves the location in the build file where the element is defined.
Inherited from Element
Initialize() void
Derived classes should override to this method to provide extra initialization and validation not covered by the base class.
Inherited from Element
Initialize(XmlNode) void
Performs default initialization.
Inherited from Element
InitializeBuildElement(Element, XmlNode, Element, Type) Element
Initializes the build element.
Inherited from Element
static
InitializeElement(XmlNode) void
Derived classes should override to this method to provide extra initialization and validation not covered by the base class.
Inherited from Element
InitializeXml(XmlNode, PropertyDictionary, FrameworkInfo) void
Initializes all build attributes and child elements.
Inherited from Element
Log(Level, string) void
Logs a message with the given priority.
Inherited from Element
Log(Level, string, Object[]) void
Logs a message with the given priority.
Inherited from Element
ToString() string
Returns the argument as a string.