コード例 #1
0
            /// <summary>
            /// Optional, use this to limit the flags that are valid with this usage.  If this method is not called,
            /// the CLI support assumes that every possible flag from the input type is valid
            /// </summary>
            /// <param name="properties"></param>
            public void ValidFlags(params Expression <Func <T, object> >[] properties)
            {
                _commandUsage.ValidFlags =
                    properties.Select(
                        expr =>
                {
                    var finder = new Baseline.Expressions.FindMembers();
                    finder.Visit(expr);
                    var member = finder.Members.Last();

                    return(_parent.Handlers.FirstOrDefault(x => x.MemberName == member.Name));
                }).ToArray();
            }
コード例 #2
0
            /// <summary>
            /// The valid arguments for this command usage in exact order
            /// </summary>
            /// <param name="properties"></param>
            /// <returns></returns>
            public UsageExpression <T> Arguments(params Expression <Func <T, object> >[] properties)
            {
                _commandUsage.Arguments =
                    properties.Select(
                        expr =>
                {
                    var finder = new Baseline.Expressions.FindMembers();
                    finder.Visit(expr);
                    var member = finder.Members.Last();

                    return(_parent.Handlers.FirstOrDefault(x => x.MemberName == member.Name));
                }).OfType
                    <Argument>();

                return(this);
            }