ravendb/ravendb — pull request #486 by MichellePrograms (2012-07-09 19:39:26+00:00)
Title: Smuggler was not allowing the pick up of a single command line argument to work

on more than one operate on type. Only passing in Indexes did not work. We made change to how the OperateOnTypes is parsed. Now it will accept single argument or multiple comma separated arguments.

Comments on Smuggler code changes
Raven.Smuggler/Program.cs

Original - options.OperateOnTypes = (ItemType) Enum.Parse(typeof (ItemType), value);
Modification - options.OperateOnTypes = (ItemType) options.ItemTypeParser(value);

Raven.Abstractions/Smuggler/SmugglerOptions.cs

Added - public ItemType ItemTypeParser(string items)
{
var result = new ItemType();
if (String.IsNullOrWhiteSpace(items))
{
return ItemType.Documents | ItemType.Indexes | ItemType.Attachments;
}
foreach (var item in items.Split(','))
{
result |= (ItemType)Enum.Parse(typeof(ItemType), item);
}
return result;
}

Added new function to correctly pass back the ItemType.

Original - [Flags]
public enum ItemType
{
Documents,
Indexes,
Attachments
}
Modified - [Flags]
public enum ItemType
{
Documents = 0x1,
Indexes = 0x2,
Attachments = 0x4
}

Modified the ItemType to include values necessary for working in .NET.