Esempio n. 1
0
        private void _DrawArguments(IReadOnlyList <IArgument> arguments, IReadOnlyList <string> explainHeads, CommandLineWriter writer, int minLength)
        {
            if (arguments.Count <= 0)
            {
                return;
            }

            writer.WriteLine();
            writer.WriteLine("Available args");
            writer.IncreaseIndent();

            for (var i = 0; i < arguments.Count; ++i)
            {
                var argument = arguments[i];
                var head     = explainHeads[i];

                head = _FillHead(minLength, head);

                writer.Write(head);
                _WriteDesc(writer, argument.Desc);

                writer.WriteLine();
            }

            writer.DecreaseIndent();
        }
Esempio n. 2
0
        private void _DrawOptions(IReadOnlyList <IOption> options, IReadOnlyList <string> explainHeads, CommandLineWriter writer, int minLength)
        {
            if (options.Count <= 0)
            {
                return;
            }

            writer.WriteLine();
            writer.WriteLine("Available options");
            writer.IncreaseIndent();

            for (int i = 0; i < options.Count; ++i)
            {
                var option = options[i];
                var head   = explainHeads[i];

                head = _FillHead(minLength, head);

                writer.Write(head);
                _WriteDesc(writer, option.Desc);

                writer.WriteLine();
            }

            writer.DecreaseIndent();
        }
Esempio n. 3
0
        private void _DrawSubcommands(CommandLineWriter writer, int minLength)
        {
            if (mGroup2Subcommands.Count <= 0)
            {
                return;
            }

            writer.WriteLine();
            writer.WriteLine("Available subcommands");
            writer.IncreaseIndent();

            foreach (var group in mGroups)
            {
                if (mGroups.Count > 1)
                {
                    writer.WriteLine(group);
                    writer.IncreaseIndent();
                }

                var commands = mGroup2Subcommands[group];
                foreach (var(command, _) in commands)
                {
                    var head = _FillHead(minLength, command.Name);

                    writer.Write(head);
                    _WriteDesc(writer, command.Desc);

                    writer.WriteLine();
                }

                if (mGroups.Count > 1)
                {
                    writer.DecreaseIndent();
                }
            }

            writer.DecreaseIndent();
        }