util

package
v0.0.0-...-16f22ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Code Generation by ChatGPT o4-mini-high with this specification: 1. Core Layout

  • Sections in order: NAME USAGE VERSION (app level only) DESCRIPTION COMMANDS (only user-defined, hide built-in "help") OPTIONS COPYRIGHT (app level only)

2. Section Headers

  • "NAME:", "USAGE:", "VERSION:", "DESCRIPTION:", "COMMANDS:", "OPTIONS:" and "COPYRIGHT:" in bold green.
  • Category headings (e.g. "Chord Options", "Gateway Options", "Global Options") in bold cyan, indented 2 spaces.

3. Wrapping & Indentation

  • Wrap all free-form text (DESCRIPTION and each flag’s usage) at 160 columns.
  • DESCRIPTION lines indented 3 spaces.
  • Flags indented 2 spaces.
  • Two-space gap between flag label and usage.
  • Wrapped continuation lines of flag usage get an extra 2-space indent.

4. Flag Grouping & Ordering

  • Group flags by their `Category` field (via reflection).
  • Alphabetically sort categories (empty category labeled "Global Options").
  • Within each category, preserve the order from the `Flags` slice.

5. Label Alignment

  • Compute the maximum width of any flag label (e.g. "--foo BAR") across all categories.
  • Right-pad every other label to that width so all usage columns start in the same column.

6. Help-flag & Help-command Suppression

  • Skip any flag whose rendered label starts with `--help`.
  • Skip the built-in `help` subcommand unless explicitly defined.

7. Color & Readability

  • Use `fatih/color` for ANSI colors:
  • Bright green for top-level headers.
  • Cyan for category headings.
  • Insert blank lines before each category and between major sections for breathing room.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOutboundIP

func GetOutboundIP() net.IP

func GetStdLogger

func GetStdLogger(parent *zap.Logger, sub string) *log.Logger

func LimitBody

func LimitBody(size int64) func(h http.Handler) http.Handler

func Must

func Must[V any](value V, err error) V

func PrettierHelpPrinter

func PrettierHelpPrinter()

PrettierHelpPrinter installs the templated HelpPrinter into urfave/cli.

func RandomTimeRange

func RandomTimeRange(interval time.Duration) time.Duration

RandomTimeRange returns time.Duration between [interval/2, interval] randomly

Types

type BufferPool

type BufferPool struct {
	// contains filtered or unexported fields
}

func NewBufferPool

func NewBufferPool(size int) *BufferPool

func (*BufferPool) Get

func (b *BufferPool) Get() []byte

func (*BufferPool) Put

func (b *BufferPool) Put(buf []byte)

Directories

Path Synopsis
Package bufconn provides a net.Conn implemented by a buffer and related dialing and listening functionality.
Package bufconn provides a net.Conn implemented by a buffer and related dialing and listening functionality.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL