MCPcopy Create free account

hub / github.com/chubin/wttr.in / functions

Functions405 in github.com/chubin/wttr.in

↓ 49 callersFunctiongetIcon
nolint:funlen
internal/renderer/v1/icons.go:4
↓ 38 callersMethodString
()
internal/ip/ip.go:34
↓ 24 callersMethodGet
Get returns a valid (non-expired) cache entry for the given key. Returns nil if the key does not exist or the entry has expired.
internal/weather/cache.go:18
↓ 23 callersMethodAdd
(step string, t time.Duration)
internal/weather/weather.go:87
↓ 21 callersMethodText
Text returns a translated string by key. It should be used for messages, captions, v1/v2 keys, etc. Do NOT pass condition codes here.
internal/localization/localizer.go:17
↓ 19 callersMethodClose
Close releases any resources held by the cache (connections, goroutines, etc.). Optional for in-memory implementations, required for networked caches.
internal/weather/cache.go:48
↓ 19 callersFunctionparseInt
Safe parsing helpers
internal/renderer/v1/helpers.go:11
↓ 13 callersMethodRemove
Remove deletes the entry (and any in-progress marker) for the given key. Typically called when the upstream response should not be cached (e.g. status
internal/weather/cache.go:44
↓ 13 callersMethodSet
Set stores a completed response in the cache under the given key. This should clear any in-progress state for the same key.
internal/weather/cache.go:22
↓ 11 callersMethodParse
Parse parses the raw query string (the part after the ? character) and returns a populated *options.Options struct with all valid, active options set.
internal/weather/weather.go:64
↓ 11 callersFunctionjustifyCenter
(s string, width int)
internal/renderer/v1/helpers.go:46
↓ 10 callersMethodFormat
(query *domain.Query, output *domain.RenderOutput)
internal/weather/weather.go:45
↓ 9 callersMethodOpen
Open opens log file.
internal/logging/suppress.go:33
↓ 7 callersMethodQuery
(location string)
internal/location/search.go:7
↓ 7 callersMethodpad
pad ensures the string has exactly `mustLen` visible runes, preserving ANSI codes.
internal/renderer/v1/format.go:406
↓ 6 callersFunctionGetFile
Example accessors GetFile returns content of a file preserving original path
internal/assets/embed.go:16
↓ 6 callersFunctionInSlice
(what string, where []string)
internal/util/strings.go:5
↓ 6 callersMethodWrite
Write writes p to log, and returns number f bytes written. Implements io.Writer interface.
internal/logging/suppress.go:57
↓ 6 callersFunctiondisplayWidth
displayWidth returns the number of columns a string occupies on a terminal. It correctly handles emojis, wide characters, combining characters, etc.
internal/renderer/v2/block_textualinformation.go:27
↓ 5 callersFunctionNew
New creates a new L10n wrapper bound to the language specified in Options. Falls back to English if no language is set.
internal/localization/localizer.go:61
↓ 5 callersMethodRender
(query domain.Query, localizer localization.Localizer)
internal/weather/weather.go:40
↓ 5 callersFunctiondimLabel
(label string)
internal/renderer/v2/block_textualinformation.go:21
↓ 4 callersMethodName
()
internal/location/search.go:6
↓ 4 callersFunctionNewLRU
NewLRU creates and returns a new LRU-based Cacher.
internal/cache/lru.go:33
↓ 4 callersFunctionNewOnelineRenderer
NewOnelineRenderer creates a new instance of the one-line renderer. At the moment it is stateless, so the constructor is very simple. It is kept as a
internal/renderer/oneline/oneline.go:40
↓ 4 callersFunctionTrueColor
Helper: create a true-color (RGB)
internal/renderer/teansi/teansi.go:74
↓ 4 callersFunctioncolorize
colorize returns the string with ANSI background color (46 = cyan bg)
internal/renderer/v2/block_timescale.go:12
↓ 4 callersFunctionconstantWidth
Helper width functions
internal/renderer/oneline/constants.go:96
↓ 4 callersFunctionerrorResponse
(s string)
internal/location/response.go:45
↓ 4 callersFunctionextractAllHourlyFloat
Helper extractors (clean and reusable)
internal/renderer/v2/helpers.go:10
↓ 4 callersMethodfilePath
(key string)
internal/cache/disk.go:43
↓ 4 callersFunctionisValidLanguageCode
isValidLanguageCode checks if the provided code is a valid 2-letter language code. This is a simplified check; in a real application, you'd have a lis
internal/query/fromrequest.go:334
↓ 4 callersFunctionisValidView
isValidView checks if the provided string is a valid view name. This is a placeholder; in a real application, you'd have a list of supported views.
internal/query/fromrequest.go:341
↓ 4 callersFunctionnormalizeLang
(lang string)
internal/translate/bundle.go:236
↓ 4 callersFunctionparseTimeStr
parseTimeStr converts "HH:MM:SS" (or "??:??:??") into a time.Time on the same day as `ref`. Falls back to `ref` on error — matches Python’s try/except
internal/renderer/v2/block_astronomical.go:82
↓ 4 callersMethodserveFromCache
(w http.ResponseWriter, e *domain.CacheEntry)
internal/weather/weather.go:240
↓ 4 callersFunctionusesImperialUnits
(ctx *RenderContext)
internal/renderer/oneline/render.go:104
↓ 3 callersFunctionNewAddressFromString
NewAddressFromString parses the location cache entry s, and return location, or error, if the cache entry is invalid.
internal/ip/ip.go:154
↓ 3 callersFunctionNewV2Renderer
NewV2Renderer creates a renderer for the v2 rich panel weather view.
internal/renderer/v2/renderer.go:21
↓ 3 callersFunctionParseQueryString
ParseQueryString parses a wttr.in query string into a map of option names to values. It validates option names, types, content, and values based on th
internal/query/parse.go:40
↓ 3 callersMethodRead
Read returns location information from the cache, if found, or types.ErrNotFound if not found. If the entry is found, but its format is invalid, types
internal/ip/ip.go:82
↓ 3 callersMethodResolve
Resolve returns location data — first from cache (LRU → persistent), then from external search.
internal/location/cache.go:229
↓ 3 callersMethodToMap
ToMap converts Options back to map[string]string. Only non-zero / non-default values are included.
internal/options/options.go:351
↓ 3 callersMethodflushBatch
(batch []*Location)
internal/location/cache.go:174
↓ 3 callersFunctiongetLatLonAndTZ
getLatLonAndTZ extracts latitude, longitude, and timezone from RenderContext Returns: - lat, lon: coordinates (0,0 if missing/invalid) - loc: timezone
internal/renderer/oneline/render_solar.go:95
↓ 3 callersFunctiongetTranslatedDesc
getTranslatedDesc returns the best available translation (lang_xx first, then English)
internal/renderer/v1/converter.go:60
↓ 3 callersFunctionhexToUint8
(s string)
internal/renderer/teansi/teansi.go:123
↓ 3 callersFunctioninterpolate
interpolate resamples data to targetWidth using cubic spline interpolation. Falls back to linear (or constant) for very short inputs.
internal/renderer/v2/interpolate.go:9
↓ 3 callersFunctionnormalizeLocationName
(name string)
internal/location/cache.go:431
↓ 3 callersFunctionpanicRecovery
panicRecovery is a middleware that recovers from panics in handlers
internal/server/server.go:103
↓ 3 callersFunctionparseFloat32
(s string)
internal/renderer/v1/helpers.go:22
↓ 3 callersFunctionslicesMax
Simple min/max helpers
internal/renderer/v2/helpers.go:39
↓ 3 callersFunctionunitWind
(unit int, lang string)
internal/renderer/v1/locale.go:82
↓ 2 callersFunctionApplyParsedMap
ApplyParsedMap populates Options from a validated map[string]string. All values are already validated by options.ParseQueryString().
internal/options/options.go:133
↓ 2 callersMethodCondition
Condition returns translated weather condition by numeric code.
internal/localization/localizer.go:20
↓ 2 callersMethodConditionByName
ConditionByName returns translated condition by its English name.
internal/localization/localizer.go:23
↓ 2 callersMethodFile
File returns raw file content (help.txt, etc.)
internal/localization/localizer.go:26
↓ 2 callersMethodGetWeather
(lat, lon float64, lang string)
internal/weather/weather.go:25
↓ 2 callersMethodIsEnabled
Helper methods (optional but very convenient)
internal/cache/config.go:48
↓ 2 callersMethodIsLRU
()
internal/cache/config.go:56
↓ 2 callersFunctionLoadDefsFromAssets
LoadDefsFromAssets loads and merges all .yaml / .yml files under spec/ in the embedded FS. Slices are appended; other fields are overridden by later f
internal/defs/defs.go:99
↓ 2 callersMethodLog
(r *http.Request)
internal/weather/weather.go:72
↓ 2 callersFunctionNewBundle
NewBundle creates and preloads all languages from the embedded FS.
internal/translate/bundle.go:27
↓ 2 callersFunctionNewNoOpCacher
NewNoOpCacher returns a new no-op cache.
internal/cache/noop.go:15
↓ 2 callersFunctionNewQueryParser
NewQueryParser returns a new QueryParser that uses the provided configuration
internal/query/queryparser.go:21
↓ 2 callersFunctionNewRequestLogger
NewRequestLogger creates a new request logger. If filename is empty, logs are dropped silently. period must be > 0, otherwise it defaults to 1 minute.
internal/logging/logging.go:37
↓ 2 callersFunctionNewV1Renderer
NewV1Renderer creates a new v1 renderer.
internal/renderer/v1/renderer.go:26
↓ 2 callersFunctionParseCurrentCondition
parseCurrentCondition extracts and normalizes current weather data from the raw JSON bytes returned by the upstream weather service.
internal/renderer/oneline/data_parse.go:44
↓ 2 callersFunctionReadUserIP
ReadUserIP returns IP address of the client from http.Request, taking into account the HTTP headers.
internal/util/http.go:11
↓ 2 callersFunctionRenderConditionEmoji
RenderConditionEmoji returns emoji/symbol + appropriate spacing. Now uses the new profile-based system (?emoji=...) while preserving backwards compati
internal/renderer/oneline/render_emoji.go:17
↓ 2 callersFunctionRenderDawn
(ctx *RenderContext)
internal/renderer/oneline/render.go:142
↓ 2 callersFunctionRenderDusk
(ctx *RenderContext)
internal/renderer/oneline/render.go:146
↓ 2 callersFunctionRenderSunrise
(ctx *RenderContext)
internal/renderer/oneline/render.go:133
↓ 2 callersFunctionRenderSunset
(ctx *RenderContext)
internal/renderer/oneline/render.go:138
↓ 2 callersFunctionSetCellColor
SetCellColor sets foreground/background color for a specific cell.
internal/renderer/teansi/teansi.go:48
↓ 2 callersMethodSetInProgressIfNotExists
SetInProgressIfNotExists marks that a request for this key is currently being processed. Used to prevent duplicate upstream requests (coalescing).
internal/weather/cache.go:26
↓ 2 callersMethodWaitForCompletion
WaitForCompletion blocks until the in-progress state for this key is cleared (i.e., the first request has finished and Set() has been called), or unti
internal/weather/cache.go:39
↓ 2 callersFunctionWriteText
WriteText writes a string at (row, col) with optional foreground/background color. Stops at screen edges. Supports \n.
internal/renderer/teansi/teansi.go:131
↓ 2 callersMethodcacheFile
── Utility functions ──────────────────────────────────────────────────────────
internal/location/cache.go:427
↓ 2 callersMethodcacheFile
cacheFile returns path to the cache entry for addr.
internal/ip/ip.go:148
↓ 2 callersFunctioncolorFromANSI
colorFromANSI converts go-te color (from Attr.Fg / Attr.Bg) to real color.Color
internal/formatter/ansitopng/colors.go:10
↓ 2 callersFunctioncolorToANSI
colorToANSI converts internal Color to ANSI escape sequence.
internal/renderer/teansi/teansi.go:90
↓ 2 callersFunctioncolorsEqual
(a, b te.Color)
internal/renderer/teansi/teansi.go:119
↓ 2 callersMethodcomputeResponse
computeResponse performs location resolution, weather fetch, rendering and formatting. Returns ready-to-cache domain.CacheEntry or error. Does NOT wri
internal/weather/weather.go:252
↓ 2 callersMethodconvertTimeToMinutes
convertTimeToMinutes converts "03:04 PM" → minutes since midnight
internal/renderer/renderer_p1.go:293
↓ 2 callersFunctionconvertValueItems
(items []domain.ValueItem)
internal/renderer/v1/converter.go:101
↓ 2 callersFunctiondrawText
(dc *gg.Context, text string, x, y float64, col color.Color)
internal/formatter/ansitopng/ansitopng.go:270
↓ 2 callersFunctionenrichLocationWithTimezone
(loc *Location)
internal/location/timezone.go:10
↓ 2 callersFunctionextractAllHourlyInt
(w domain.Weather, getter func(domain.Hourly) string)
internal/renderer/v2/helpers.go:24
↓ 2 callersMethodflush
flush writes the current buffer to disk and resets it. It is safe to call concurrently.
internal/logging/logging.go:80
↓ 2 callersMethodformatCond
formatCond builds the 5-line current/forecast condition block. prefix is " " for current condition, "│" for forecast blocks inside the box.
internal/renderer/v1/format.go:302
↓ 2 callersMethodformatRain
formatRain formats precipitation amount and chance of rain.
internal/renderer/v1/format.go:277
↓ 2 callersMethodformatTemp
formatTemp formats temperature (with feels-like in parentheses when different).
internal/renderer/v1/format.go:78
↓ 2 callersMethodformatVisibility
formatVisibility formats visibility.
internal/renderer/v1/format.go:261
↓ 2 callersMethodformatWind
formatWind formats wind direction + speed (+ gust if stronger).
internal/renderer/v1/format.go:223
↓ 2 callersFunctiongetClientIP
Helper to get the "best guess" client IP — handles proxies/load balancers
internal/weather/weather.go:141
↓ 2 callersFunctiongetString
(m map[string]any, key string)
internal/localization/weatherer_translate.go:108
↓ 2 callersFunctiongetValueItems
Helper functions
internal/localization/weatherer_translate.go:95
↓ 2 callersMethodinitLRUOnce
── LRU helpers ────────────────────────────────────────────────────────────────
internal/location/cache.go:387
↓ 2 callersFunctionisPlainTextClient
isPlainTextClient determines if the User-Agent indicates a plain text client like curl or wget.
internal/query/fromrequest.go:361
next →1–100 of 405, ranked by callers