Exemplo n.º 1
0
        /**
         * Utility method for registering new commands.
         *
         * <p>This is a shortcut for calling {@link RootCommandNode#addChild(CommandNode)} after building the provided {@code command}.</p>
         *
         * <p>As {@link RootCommandNode} can only hold literals, this method will only allow literal arguments.</p>
         *
         * @param command a literal argument builder to add to this command tree
         * @return the node added to this tree
         */
        public LiteralCommandNode <TSource> Register(LiteralArgumentBuilder <TSource> command)
        {
            var build = command.Build();

            _root.AddChild(build);
            return(build);
        }
        public void TestBuild()
        {
            var node = _builder.Build();

            node.Literal.Should().Be("foo");
        }