Exemplo n.º 1
0
            /// <summary>
            /// Return the ith row of the column as a set of wrapped strings, each at
            /// most wrapWidth in length.
            /// </summary>
            internal virtual string[] GetRow(int idx)
            {
                string raw = rows[idx];

                // Line-wrap if it's too long
                string[] lines = new string[] { raw };
                if (wrap)
                {
                    lines = WordUtils.Wrap(lines[0], wrapWidth, "\n", true).Split("\n");
                }
                for (int i = 0; i < lines.Length; i++)
                {
                    if (justification == TableListing.Justification.Left)
                    {
                        lines[i] = StringUtils.RightPad(lines[i], maxWidth);
                    }
                    else
                    {
                        if (justification == TableListing.Justification.Right)
                        {
                            lines[i] = StringUtils.LeftPad(lines[i], maxWidth);
                        }
                    }
                }
                return(lines);
            }
Exemplo n.º 2
0
            public virtual string GetLongUsage()
            {
                TableListing listing = AdminHelper.GetOptionDescriptionListing();

                listing.AddRow("-stats", "Display additional cache pool statistics.");
                listing.AddRow("<name>", "If specified, list only the named cache pool.");
                return(GetShortUsage() + "\n" + WordUtils.Wrap("Display information about one or more cache pools, "
                                                               + "e.g. name, owner, group, permissions, etc.", AdminHelper.MaxLineWidth) + "\n\n"
                       + listing.ToString());
            }
Exemplo n.º 3
0
            public virtual string GetLongUsage()
            {
                TableListing listing = AdminHelper.GetOptionDescriptionListing();

                listing.AddRow("<name>", "Name of the pool to modify.");
                listing.AddRow("<owner>", "Username of the owner of the pool");
                listing.AddRow("<group>", "Groupname of the group of the pool.");
                listing.AddRow("<mode>", "Unix-style permissions of the pool in octal.");
                listing.AddRow("<limit>", "Maximum number of bytes that can be cached " + "by this pool."
                               );
                listing.AddRow("<maxTtl>", "The maximum allowed time-to-live for " + "directives being added to the pool."
                               );
                return(GetShortUsage() + "\n" + WordUtils.Wrap("Modifies the metadata of an existing cache pool. "
                                                               + "See usage of " + CacheAdmin.AddCachePoolCommand.Name + " for more details.",
                                                               AdminHelper.MaxLineWidth) + "\n\n" + listing.ToString());
            }
Exemplo n.º 4
0
        private void PrintInstanceHelp(TextWriter @out, Command instance)
        {
            @out.WriteLine(instance.GetUsage() + " :");
            TableListing listing = null;
            string       prefix  = "  ";

            foreach (string line in instance.GetDescription().Split("\n"))
            {
                if (line.Matches("^[ \t]*[-<].*$"))
                {
                    string[] segments = line.Split(":");
                    if (segments.Length == 2)
                    {
                        if (listing == null)
                        {
                            listing = CreateOptionTableListing();
                        }
                        listing.AddRow(segments[0].Trim(), segments[1].Trim());
                        continue;
                    }
                }
                // Normal literal description.
                if (listing != null)
                {
                    foreach (string listingLine in listing.ToString().Split("\n"))
                    {
                        @out.WriteLine(prefix + listingLine);
                    }
                    listing = null;
                }
                foreach (string descLine in WordUtils.Wrap(line, MaxLineWidth, "\n", true).Split(
                             "\n"))
                {
                    @out.WriteLine(prefix + descLine);
                }
            }
            if (listing != null)
            {
                foreach (string listingLine in listing.ToString().Split("\n"))
                {
                    @out.WriteLine(prefix + listingLine);
                }
            }
        }
Exemplo n.º 5
0
 public virtual string GetLongUsage()
 {
     return(GetShortUsage() + "\n" + WordUtils.Wrap("Remove a cache pool. This also uncaches paths "
                                                    + "associated with the pool.\n\n", AdminHelper.MaxLineWidth) + "<name>  Name of the cache pool to remove.\n");
 }