Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/chubin/wttr.in
/ functions
Functions
405 in github.com/chubin/wttr.in
⨍
Functions
405
◇
Types & classes
112
↓ 49 callers
Function
getIcon
nolint:funlen
internal/renderer/v1/icons.go:4
↓ 38 callers
Method
String
()
internal/ip/ip.go:34
↓ 24 callers
Method
Get
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 callers
Method
Add
(step string, t time.Duration)
internal/weather/weather.go:87
↓ 21 callers
Method
Text
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 callers
Method
Close
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 callers
Function
parseInt
Safe parsing helpers
internal/renderer/v1/helpers.go:11
↓ 13 callers
Method
Remove
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 callers
Method
Set
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 callers
Method
Parse
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 callers
Function
justifyCenter
(s string, width int)
internal/renderer/v1/helpers.go:46
↓ 10 callers
Method
Format
(query *domain.Query, output *domain.RenderOutput)
internal/weather/weather.go:45
↓ 9 callers
Method
Open
Open opens log file.
internal/logging/suppress.go:33
↓ 7 callers
Method
Query
(location string)
internal/location/search.go:7
↓ 7 callers
Method
pad
pad ensures the string has exactly `mustLen` visible runes, preserving ANSI codes.
internal/renderer/v1/format.go:406
↓ 6 callers
Function
GetFile
Example accessors GetFile returns content of a file preserving original path
internal/assets/embed.go:16
↓ 6 callers
Function
InSlice
(what string, where []string)
internal/util/strings.go:5
↓ 6 callers
Method
Write
Write writes p to log, and returns number f bytes written. Implements io.Writer interface.
internal/logging/suppress.go:57
↓ 6 callers
Function
displayWidth
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 callers
Function
New
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 callers
Method
Render
(query domain.Query, localizer localization.Localizer)
internal/weather/weather.go:40
↓ 5 callers
Function
dimLabel
(label string)
internal/renderer/v2/block_textualinformation.go:21
↓ 4 callers
Method
Name
()
internal/location/search.go:6
↓ 4 callers
Function
NewLRU
NewLRU creates and returns a new LRU-based Cacher.
internal/cache/lru.go:33
↓ 4 callers
Function
NewOnelineRenderer
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 callers
Function
TrueColor
Helper: create a true-color (RGB)
internal/renderer/teansi/teansi.go:74
↓ 4 callers
Function
colorize
colorize returns the string with ANSI background color (46 = cyan bg)
internal/renderer/v2/block_timescale.go:12
↓ 4 callers
Function
constantWidth
Helper width functions
internal/renderer/oneline/constants.go:96
↓ 4 callers
Function
errorResponse
(s string)
internal/location/response.go:45
↓ 4 callers
Function
extractAllHourlyFloat
Helper extractors (clean and reusable)
internal/renderer/v2/helpers.go:10
↓ 4 callers
Method
filePath
(key string)
internal/cache/disk.go:43
↓ 4 callers
Function
isValidLanguageCode
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 callers
Function
isValidView
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 callers
Function
normalizeLang
(lang string)
internal/translate/bundle.go:236
↓ 4 callers
Function
parseTimeStr
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 callers
Method
serveFromCache
(w http.ResponseWriter, e *domain.CacheEntry)
internal/weather/weather.go:240
↓ 4 callers
Function
usesImperialUnits
(ctx *RenderContext)
internal/renderer/oneline/render.go:104
↓ 3 callers
Function
NewAddressFromString
NewAddressFromString parses the location cache entry s, and return location, or error, if the cache entry is invalid.
internal/ip/ip.go:154
↓ 3 callers
Function
NewV2Renderer
NewV2Renderer creates a renderer for the v2 rich panel weather view.
internal/renderer/v2/renderer.go:21
↓ 3 callers
Function
ParseQueryString
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 callers
Method
Read
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 callers
Method
Resolve
Resolve returns location data — first from cache (LRU → persistent), then from external search.
internal/location/cache.go:229
↓ 3 callers
Method
ToMap
ToMap converts Options back to map[string]string. Only non-zero / non-default values are included.
internal/options/options.go:351
↓ 3 callers
Method
flushBatch
(batch []*Location)
internal/location/cache.go:174
↓ 3 callers
Function
getLatLonAndTZ
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 callers
Function
getTranslatedDesc
getTranslatedDesc returns the best available translation (lang_xx first, then English)
internal/renderer/v1/converter.go:60
↓ 3 callers
Function
hexToUint8
(s string)
internal/renderer/teansi/teansi.go:123
↓ 3 callers
Function
interpolate
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 callers
Function
normalizeLocationName
(name string)
internal/location/cache.go:431
↓ 3 callers
Function
panicRecovery
panicRecovery is a middleware that recovers from panics in handlers
internal/server/server.go:103
↓ 3 callers
Function
parseFloat32
(s string)
internal/renderer/v1/helpers.go:22
↓ 3 callers
Function
slicesMax
Simple min/max helpers
internal/renderer/v2/helpers.go:39
↓ 3 callers
Function
unitWind
(unit int, lang string)
internal/renderer/v1/locale.go:82
↓ 2 callers
Function
ApplyParsedMap
ApplyParsedMap populates Options from a validated map[string]string. All values are already validated by options.ParseQueryString().
internal/options/options.go:133
↓ 2 callers
Method
Condition
Condition returns translated weather condition by numeric code.
internal/localization/localizer.go:20
↓ 2 callers
Method
ConditionByName
ConditionByName returns translated condition by its English name.
internal/localization/localizer.go:23
↓ 2 callers
Method
File
File returns raw file content (help.txt, etc.)
internal/localization/localizer.go:26
↓ 2 callers
Method
GetWeather
(lat, lon float64, lang string)
internal/weather/weather.go:25
↓ 2 callers
Method
IsEnabled
Helper methods (optional but very convenient)
internal/cache/config.go:48
↓ 2 callers
Method
IsLRU
()
internal/cache/config.go:56
↓ 2 callers
Function
LoadDefsFromAssets
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 callers
Method
Log
(r *http.Request)
internal/weather/weather.go:72
↓ 2 callers
Function
NewBundle
NewBundle creates and preloads all languages from the embedded FS.
internal/translate/bundle.go:27
↓ 2 callers
Function
NewNoOpCacher
NewNoOpCacher returns a new no-op cache.
internal/cache/noop.go:15
↓ 2 callers
Function
NewQueryParser
NewQueryParser returns a new QueryParser that uses the provided configuration
internal/query/queryparser.go:21
↓ 2 callers
Function
NewRequestLogger
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 callers
Function
NewV1Renderer
NewV1Renderer creates a new v1 renderer.
internal/renderer/v1/renderer.go:26
↓ 2 callers
Function
ParseCurrentCondition
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 callers
Function
ReadUserIP
ReadUserIP returns IP address of the client from http.Request, taking into account the HTTP headers.
internal/util/http.go:11
↓ 2 callers
Function
RenderConditionEmoji
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 callers
Function
RenderDawn
(ctx *RenderContext)
internal/renderer/oneline/render.go:142
↓ 2 callers
Function
RenderDusk
(ctx *RenderContext)
internal/renderer/oneline/render.go:146
↓ 2 callers
Function
RenderSunrise
(ctx *RenderContext)
internal/renderer/oneline/render.go:133
↓ 2 callers
Function
RenderSunset
(ctx *RenderContext)
internal/renderer/oneline/render.go:138
↓ 2 callers
Function
SetCellColor
SetCellColor sets foreground/background color for a specific cell.
internal/renderer/teansi/teansi.go:48
↓ 2 callers
Method
SetInProgressIfNotExists
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 callers
Method
WaitForCompletion
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 callers
Function
WriteText
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 callers
Method
cacheFile
── Utility functions ──────────────────────────────────────────────────────────
internal/location/cache.go:427
↓ 2 callers
Method
cacheFile
cacheFile returns path to the cache entry for addr.
internal/ip/ip.go:148
↓ 2 callers
Function
colorFromANSI
colorFromANSI converts go-te color (from Attr.Fg / Attr.Bg) to real color.Color
internal/formatter/ansitopng/colors.go:10
↓ 2 callers
Function
colorToANSI
colorToANSI converts internal Color to ANSI escape sequence.
internal/renderer/teansi/teansi.go:90
↓ 2 callers
Function
colorsEqual
(a, b te.Color)
internal/renderer/teansi/teansi.go:119
↓ 2 callers
Method
computeResponse
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 callers
Method
convertTimeToMinutes
convertTimeToMinutes converts "03:04 PM" → minutes since midnight
internal/renderer/renderer_p1.go:293
↓ 2 callers
Function
convertValueItems
(items []domain.ValueItem)
internal/renderer/v1/converter.go:101
↓ 2 callers
Function
drawText
(dc *gg.Context, text string, x, y float64, col color.Color)
internal/formatter/ansitopng/ansitopng.go:270
↓ 2 callers
Function
enrichLocationWithTimezone
(loc *Location)
internal/location/timezone.go:10
↓ 2 callers
Function
extractAllHourlyInt
(w domain.Weather, getter func(domain.Hourly) string)
internal/renderer/v2/helpers.go:24
↓ 2 callers
Method
flush
flush writes the current buffer to disk and resets it. It is safe to call concurrently.
internal/logging/logging.go:80
↓ 2 callers
Method
formatCond
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 callers
Method
formatRain
formatRain formats precipitation amount and chance of rain.
internal/renderer/v1/format.go:277
↓ 2 callers
Method
formatTemp
formatTemp formats temperature (with feels-like in parentheses when different).
internal/renderer/v1/format.go:78
↓ 2 callers
Method
formatVisibility
formatVisibility formats visibility.
internal/renderer/v1/format.go:261
↓ 2 callers
Method
formatWind
formatWind formats wind direction + speed (+ gust if stronger).
internal/renderer/v1/format.go:223
↓ 2 callers
Function
getClientIP
Helper to get the "best guess" client IP — handles proxies/load balancers
internal/weather/weather.go:141
↓ 2 callers
Function
getString
(m map[string]any, key string)
internal/localization/weatherer_translate.go:108
↓ 2 callers
Function
getValueItems
Helper functions
internal/localization/weatherer_translate.go:95
↓ 2 callers
Method
initLRUOnce
── LRU helpers ────────────────────────────────────────────────────────────────
internal/location/cache.go:387
↓ 2 callers
Function
isPlainTextClient
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