Click or drag to resize

CommandBundle Class

Describes a collection of files to be uploaded to a Linux server along with the command to be executed after the files have been unpacked.
Inheritance Hierarchy
SystemObject
  System.Collections.GenericListCommandFile
    Neon.SSHCommandBundle

Namespace:  Neon.SSH
Assembly:  Neon.SSH (in Neon.SSH.dll) Version: 2.14.0
Syntax
public class CommandBundle : List<CommandFile>, 
	IBashCommandFormatter

The CommandBundle type exposes the following members.

Constructors
  NameDescription
Public methodCommandBundle
Constructor.
Top
Properties
  NameDescription
Public propertyArgs
Returns the command arguments.
Public propertyCapacity
Gets or sets the total number of elements the internal data structure can hold without resizing.
(Inherited from ListCommandFile.)
Public propertyCommand
Returns the command to be executed after the bundle has been unpacked.
Public propertyCount (Inherited from ListCommandFile.)
Public propertyItem
Gets or sets the element at the specified index.
(Inherited from ListCommandFile.)
Top
Methods
  NameDescription
Public methodAdd (Inherited from ListCommandFile.)
Public methodAddFile(String, Byte, Boolean)
Adds a binary file to be uploaded before executing the command.
Public methodAddFile(String, String, Boolean, Boolean)
Adds a text file to be uploaded before executing the command.
Public methodAddRange (Inherited from ListCommandFile.)
Public methodAddZip
Creates a ZIP file, recursively adding all of the files in a local source folder and then adds the ZIP file to the bundle.
Public methodAsReadOnly (Inherited from ListCommandFile.)
Public methodBinarySearch(T)
Searches the entire sorted ListT for an element using the default comparer and returns the zero-based index of the element.
(Inherited from ListCommandFile.)
Public methodBinarySearch(T, IComparerT)
Searches the entire sorted ListT for an element using the specified comparer and returns the zero-based index of the element.
(Inherited from ListCommandFile.)
Public methodBinarySearch(Int32, Int32, T, IComparerT)
Searches a range of elements in the sorted ListT for an element using the specified comparer and returns the zero-based index of the element.
(Inherited from ListCommandFile.)
Public methodClear (Inherited from ListCommandFile.)
Public methodContains (Inherited from ListCommandFile.)
Public methodConvertAllTOutput (Inherited from ListCommandFile.)
Public methodCopyTo(T) (Inherited from ListCommandFile.)
Public methodCopyTo(T, Int32) (Inherited from ListCommandFile.)
Public methodCopyTo(Int32, T, Int32, Int32)
Copies a range of elements from the ListT to a compatible one-dimensional array, starting at the specified index of the target array.
(Inherited from ListCommandFile.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodExists (Inherited from ListCommandFile.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFind
Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire ListT.
(Inherited from ListCommandFile.)
Public methodFindAll
Retrieves all the elements that match the conditions defined by the specified predicate.
(Inherited from ListCommandFile.)
Public methodFindIndex(PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire ListT.
(Inherited from ListCommandFile.)
Public methodFindIndex(Int32, PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the ListT that extends from the specified index to the last element.
(Inherited from ListCommandFile.)
Public methodFindIndex(Int32, Int32, PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the ListT that starts at the specified index and contains the specified number of elements.
(Inherited from ListCommandFile.)
Public methodFindLast
Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire ListT.
(Inherited from ListCommandFile.)
Public methodFindLastIndex(PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire ListT.
(Inherited from ListCommandFile.)
Public methodFindLastIndex(Int32, PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the ListT that extends from the first element to the specified index.
(Inherited from ListCommandFile.)
Public methodFindLastIndex(Int32, Int32, PredicateT)
Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the ListT that contains the specified number of elements and ends at the specified index.
(Inherited from ListCommandFile.)
Public methodForEach (Inherited from ListCommandFile.)
Public methodStatic memberFromScript(String)
Creates a bundle that simply uploads and runs a (string) script.
Public methodStatic memberFromScript(StringBuilder)
Creates a bundle that simply uploads and runs a (StringBuilder) script.
Public methodGetEnumerator (Inherited from ListCommandFile.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetRange (Inherited from ListCommandFile.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf(T) (Inherited from ListCommandFile.)
Public methodIndexOf(T, Int32)
Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the ListT that extends from the specified index to the last element.
(Inherited from ListCommandFile.)
Public methodIndexOf(T, Int32, Int32)
Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the ListT that starts at the specified index and contains the specified number of elements.
(Inherited from ListCommandFile.)
Public methodInsert (Inherited from ListCommandFile.)
Public methodInsertRange (Inherited from ListCommandFile.)
Public methodLastIndexOf(T) (Inherited from ListCommandFile.)
Public methodLastIndexOf(T, Int32)
Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the ListT that extends from the first element to the specified index.
(Inherited from ListCommandFile.)
Public methodLastIndexOf(T, Int32, Int32)
Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the ListT that contains the specified number of elements and ends at the specified index.
(Inherited from ListCommandFile.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodStatic memberNormalizeArgs
Normalizes the bundle command arguments into a single list of strings by expanding any arguments that can enumerate strings, normalizing common value types like booleans, and adding surrounding quotes if necessary.
Public methodRemove (Inherited from ListCommandFile.)
Public methodRemoveAll
Removes all the elements that match the conditions defined by the specified predicate.
(Inherited from ListCommandFile.)
Public methodRemoveAt (Inherited from ListCommandFile.)
Public methodRemoveRange (Inherited from ListCommandFile.)
Public methodReverse (Inherited from ListCommandFile.)
Public methodReverse(Int32, Int32)
Reverses the order of the elements in the specified range.
(Inherited from ListCommandFile.)
Public methodSort (Inherited from ListCommandFile.)
Public methodSort(IComparerT) (Inherited from ListCommandFile.)
Public methodSort(ComparisonT) (Inherited from ListCommandFile.)
Public methodSort(Int32, Int32, IComparerT) (Inherited from ListCommandFile.)
Public methodToArray (Inherited from ListCommandFile.)
Public methodToBash

Formats the command such that it could be added to a Bash script.

Note Note
This doesn't work if the command has attached files.
Public methodToString
Renders the command and arguments as a Bash compatible command line.
(Overrides ObjectToString.)
Public methodTrimExcess (Inherited from ListCommandFile.)
Public methodTrueForAll (Inherited from ListCommandFile.)
Public methodValidate
Verifies that the bundle is valid.
Top
Fields
  NameDescription
Public fieldStatic memberArgBreak

This is a meta command line argument that can be added to a command to indicate that the following non-command line option is not to be considered to be the value for the previous command line option.

This is entirely optional but can make ToBash(String) formatting a bit nicer.

Top
Remarks

This class is intended for use with the RunCommand(CommandBundle, RunOptions) and SudoCommand(CommandBundle, RunOptions) methods for situations where one or more files need to be uploaded to a cluster node and be used when a command is executed.

To use this class, construct an instance passing the command and arguments to be executed. The command be an absolute reference to an executable in folders such as /bin or /usr/local/bin, an executable somewhere on the current PATH, or relative to the files unpacked from the bundle. The current working directory will be set to the folder where the bundle was unpacked, so you can reference local executables like ./MyExecutable.

Once a bundle is constructed, you will add CommandFile instances specifying the file data you want to include. These include the relative path to the file to be uploaded as well as its text or binary data. You may also indicate whether each file is to be marked as executable.

See Also