| 1 |
// Package format provides utilities for formatting, parsing, and rendering notification service |
| 2 |
// configurations in the shoutrrr library. |
| 3 |
// |
| 4 |
// This package handles various aspects of service configuration management: |
| 5 |
// |
| 6 |
// # Query String Handling |
| 7 |
// |
| 8 |
// The package provides functions for building and parsing URL query strings that represent |
| 9 |
// service configurations. It supports custom fields that can be escaped to avoid conflicts |
| 10 |
// with built-in configuration properties using the "__" prefix. |
| 11 |
// |
| 12 |
// Key functions: |
| 13 |
// - BuildQuery: Converts a config object to a query string |
| 14 |
// - BuildQueryWithCustomFields: Builds a query with custom fields, escaping conflicting keys |
| 15 |
// - SetConfigPropsFromQuery: Sets config properties from query string values |
| 16 |
// - EscapeKey/UnescapeKey: Escapes/unescapes keys that conflict with config props |
| 17 |
// |
| 18 |
// # Configuration Formatting |
| 19 |
// |
| 20 |
// The package includes comprehensive support for parsing and formatting various field types |
| 21 |
// found in service configurations: |
| 22 |
// |
| 23 |
// - Basic types: strings, integers, booleans |
| 24 |
// - Complex types: maps, slices, arrays, structs |
| 25 |
// - Enum types: enumerated values with named options |
| 26 |
// |
| 27 |
// Key functions: |
| 28 |
// - ParseBool/PrintBool: Parse and print boolean values |
| 29 |
// - IsNumber: Check if a string represents a number |
| 30 |
// - SetConfigField: Set a config field from a string value |
| 31 |
// - GetConfigFieldString: Get string representation of a config field |
| 32 |
// - GetConfigFormat: Get type and field information from a service config |
| 33 |
// |
| 34 |
// # Property Serialization |
| 35 |
// |
| 36 |
// The package provides serialization/deserialization support for configuration properties |
| 37 |
// that implement the ConfigProp interface: |
| 38 |
// |
| 39 |
// Key functions: |
| 40 |
// - GetConfigPropFromString: Deserialize a config property from a string |
| 41 |
// - GetConfigPropString: Serialize a config property to a string |
| 42 |
// |
| 43 |
// # Output Rendering |
| 44 |
// |
| 45 |
// The package supports multiple output formats for displaying configuration trees: |
| 46 |
// |
| 47 |
// - Console output with color highlighting |
| 48 |
// - Markdown output for documentation |
| 49 |
// - Tree-based hierarchical display |
| 50 |
// |
| 51 |
// Key functions: |
| 52 |
// - ColorFormatTree: Generate color-highlighted tree output |
| 53 |
// - ConsoleTreeRenderer: Render configuration as console-friendly tree |
| 54 |
// - MarkdownTreeRenderer: Render configuration as markdown |
| 55 |
// |
| 56 |
// # Key Concepts |
| 57 |
// |
| 58 |
// KeyPrefix ("__"): Prefix used to escape custom URL query keys that would otherwise |
| 59 |
// conflict with built-in service configuration property names. |
| 60 |
// |
| 61 |
// ConfigQueryResolver: Interface for objects that can provide and accept configuration |
| 62 |
// through query string parameters. |
| 63 |
// |
| 64 |
// ContainerNode: Tree node structure representing configuration hierarchies. |
| 65 |
// |
| 66 |
// FieldInfo: Metadata about configuration fields including type, constraints, and |
| 67 |
// formatting information. |
| 68 |
// |
| 69 |
// EnumFormatter: Interface for handling enumerated configuration values with |
| 70 |
// named options. |
| 71 |
package format |