internal static CommandLineAction Create(PropertyInfo actionProperty, List<string> knownAliases)
        {
            var ret = PropertyInitializer.CreateInstance<CommandLineAction>();
            ret.ActionMethod = ArgAction.ResolveMethod(actionProperty.DeclaringType, actionProperty);
            ret.Source = actionProperty;
            ret.Arguments.AddRange(new CommandLineArgumentsDefinition(actionProperty.PropertyType).Arguments);
            ret.IgnoreCase = true;

            if (actionProperty.DeclaringType.HasAttr<ArgIgnoreCase>() && actionProperty.DeclaringType.Attr<ArgIgnoreCase>().IgnoreCase == false)
            {
                ret.IgnoreCase = false;
            }

            if (actionProperty.HasAttr<ArgIgnoreCase>() && actionProperty.Attr<ArgIgnoreCase>().IgnoreCase == false)
            {
                ret.IgnoreCase = false;
            }

            ret.Metadata.AddRange(actionProperty.Attrs<IArgMetadata>().AssertAreAllInstanceOf<ICommandLineActionMetadata>());

            // This line only calls into CommandLineArgument because the code to strip 'Args' off the end of the
            // action property name lives here.  This is a pre 2.0 hack that's only left in place to support apps that
            // use the 'Args' suffix pattern.
            ret.Aliases.AddRange(CommandLineArgument.FindDefaultShortcuts(actionProperty, knownAliases, ret.IgnoreCase));

            return ret;
        }
        internal static List<string> FindDefaultShortcuts(PropertyInfo info, List<string> knownShortcuts, bool ignoreCase)
        {
            List<string> ret = new List<string>();

            bool excludeName = info.Attrs<ArgShortcut>().Where(s => s.Policy == ArgShortcutPolicy.ShortcutsOnly).Count() > 0;

            if (excludeName == false)
            {
                knownShortcuts.Add(info.Name);

                if (CommandLineAction.IsActionImplementation(info) && info.Name.EndsWith(Constants.ActionArgConventionSuffix))
                {
                    ret.Add(info.Name.Substring(0, info.Name.Length - Constants.ActionArgConventionSuffix.Length));
                }
                else
                {
                    ret.Add(info.Name);
                }
            }

            var attrs = info.Attrs<ArgShortcut>();

            if (attrs.Count == 0)
            {
                var shortcut = GenerateShortcutAlias(info.Name, knownShortcuts, ignoreCase);
                if (shortcut != null)
                {
                    knownShortcuts.Add(shortcut);
                    ret.Add(shortcut);
                }

                return ret;
            }
            else
            {
                return ret;
            }
        }
        internal static CommandLineArgument Create(PropertyInfo property, List<string> knownAliases)
        {
            var ret = PropertyInitializer.CreateInstance<CommandLineArgument>();
            ret.DefaultValue = property.HasAttr<DefaultValueAttribute>() ? property.Attr<DefaultValueAttribute>().Value : null;
            ret.Position = property.HasAttr<ArgPosition>() ? property.Attr<ArgPosition>().Position : -1;
            ret.Source = property;
            ret.ArgumentType = property.PropertyType;

            ret.IgnoreCase = true;

            if (property.DeclaringType.HasAttr<ArgIgnoreCase>() && property.DeclaringType.Attr<ArgIgnoreCase>().IgnoreCase == false)
            {
                ret.IgnoreCase = false;
            }

            if (property.HasAttr<ArgIgnoreCase>() && property.Attr<ArgIgnoreCase>().IgnoreCase == false)
            {
                ret.IgnoreCase = false;
            }

            ret.Aliases.AddRange(FindDefaultShortcuts(property, knownAliases, ret.IgnoreCase));

            // TODO - I think the first generic call can just be more specific
            ret.Metadata.AddRange(property.Attrs<IArgMetadata>().AssertAreAllInstanceOf<ICommandLineArgumentMetadata>());

            return ret;
        }
        private static List<string> FindShortcutsInternal(PropertyInfo info, List<string> knownShortcuts)
        {
            var actionProperty = ArgAction.GetActionProperty(info.DeclaringType);
            if (actionProperty != null && actionProperty.Name == info.Name) return new List<string>();

            var attrs = info.Attrs<ArgShortcut>();

            if (attrs.Count == 0)
            {
                string shortcutVal = "";
                foreach (char c in info.GetArgumentName())
                {
                    shortcutVal += c;
                    if (knownShortcuts.Contains(shortcutVal) == false) return new List<string>{ shortcutVal };
                }
                return new List<string> { shortcutVal };
            }
            else
            {
                List<string> ret = new List<string>();
                bool noShortcut = false;
                foreach (var attr in attrs)
                {
                    if (attr.policy.HasValue && attr.policy.Value == ArgShortcutPolicy.NoShortcut)
                    {
                        noShortcut = true;
                    }

                    if (noShortcut && attr.Shortcut != null)
                    {
                        throw new InvalidArgDefinitionException("You cannot specify a shortcut value and an ArgShortcutPolicy of NoShortcut");
                    }

                    if (attr.Shortcut != null)
                    {
                        if (attr.Shortcut.StartsWith("-")) attr.Shortcut = attr.Shortcut.Substring(1);
                        else if (attr.Shortcut.StartsWith("/")) attr.Shortcut = attr.Shortcut.Substring(1);
                    }

                    if (attr.Shortcut != null)
                    {
                        ret.Add(attr.Shortcut);
                    }
                }

                return ret;
            }
        }
        internal static List<string> FindDefaultShortcuts(PropertyInfo info, List<string> knownShortcuts, bool ignoreCase)
        {
            List<string> ret = new List<string>();

            var argumentName = info.Name;

            bool excludeName = info.Attrs<ArgShortcut>().Where(s => s.Policy == ArgShortcutPolicy.ShortcutsOnly).Count() > 0;

            if (excludeName == false)
            {
                knownShortcuts.Add(info.Name);

                if (CommandLineAction.IsActionImplementation(info) && argumentName.EndsWith(Constants.ActionArgConventionSuffix))
                {
                    ret.Add(info.Name.Substring(0, argumentName.Length - Constants.ActionArgConventionSuffix.Length));
                }
                else
                {
                    ret.Add(argumentName);
                }
            }

            var attrs = info.Attrs<ArgShortcut>();

            if (attrs.Count == 0)
            {
                var longFormShortcut = PascalCaseNameSplitter(info.Name);
                if (!knownShortcuts.Any(x => x.Equals(longFormShortcut, StringComparison.OrdinalIgnoreCase)))
                {
                    knownShortcuts.Add(longFormShortcut);
                    ret.Add(longFormShortcut);
                }
            }
            ret.Reverse();
            return ret;
        }
        private static List<string> FindShortcutsInternal(PropertyInfo info, List<string> knownShortcuts)
        {
            var actionProperty = ArgAction.GetActionProperty(info.DeclaringType);
            if (actionProperty != null && actionProperty.Name == info.Name) return new List<string>();

            var attrs = info.Attrs<ArgShortcut>();

            bool ignoreCase = true;
            if (info.DeclaringType.HasAttr<ArgIgnoreCase>() && info.DeclaringType.Attr<ArgIgnoreCase>().IgnoreCase == false) ignoreCase = false;

            if (attrs.Count == 0)
            {
                string shortcutVal = "";
                foreach (char c in info.GetArgumentName().Substring(0, info.GetArgumentName().Length-1))
                {
                    shortcutVal += c;
                    if (knownShortcuts.Contains(shortcutVal) == false) return new List<string>{ ignoreCase ? shortcutVal.ToLower() : shortcutVal };
                }
                return new List<string>();
            }
            else
            {
                List<string> ret = new List<string>();
                foreach (var attr in attrs.OrderBy(a => a.Shortcut == null ? 0 : a.Shortcut.Length))
                {
                    bool noShortcut = false;
                    if (attr.Policy == ArgShortcutPolicy.NoShortcut)
                    {
                        noShortcut = true;
                    }

                    if (noShortcut && attr.Shortcut != null)
                    {
                        throw new InvalidArgDefinitionException("You cannot specify a shortcut value and an ArgShortcutPolicy of NoShortcut");
                    }

                    if (attr.Shortcut != null)
                    {
                        if (attr.Shortcut.StartsWith("-")) attr.Shortcut = attr.Shortcut.Substring(1);
                        else if (attr.Shortcut.StartsWith("/")) attr.Shortcut = attr.Shortcut.Substring(1);
                    }

                    if (attr.Shortcut != null)
                    {
                        ret.Add(ignoreCase ? attr.Shortcut.ToLower() : attr.Shortcut);
                    }
                }

                return ret;
            }
        }