CLI TimeZone Info for .NET 6 in FSharp. Ported from https://github.com/merschformann/gotz
Consider fitz more of a distribution than a fork of gotz.
# Name the bucket whatever you'd like
scoop add bucket endo-scoop https://github.com/endowdly/endo-scoop/
scoop install fitz
Directly via dotnet
dotnet tool install --global Endowdly.Fitz --version 0.1.0
Binaries are available for the latest release.
Platforms available:
- linux-arm64
- linux-x64
- osx-x64 (darwin-x64)
- win-arm64
- win10-x86
These binaries are self-contained dotnet executables, which include a trimmed .NET Runtime. Therefore, no additional tooling is needed to run the binaries (on the supported platforms). Note that most of the binaries clock in around 20MB due to the size of the embedded runtime.
fitz is largely identical in appearance and configuration to gotz. However, fitz is implemented completely differently so some functional differences exist.
What fitz does differently than gotz:
- fitz parses time differently
- fitz parses both IANA and Microsoft Timezone Ids
- fitz uses an alternate screen buffer when entering live mode to keep your current buffer intact
- fitz does not overwrite your configuration file with current command-line settings
- fitz has a slightly different configuration file
Can show the current time:
fitz
or can show any time...
fitz "23:00"
fitz "03/17/2007 18:30"
These are the strings that can be parsed by .NET's library to see what fitz can handle.
Like gotz, fitz uses IANA timezones. Unlike gotz, fitz also accepts and understands Microsoft TimeZone Ids.
Get specific timezones:
fitz --timezones "Work:America/Chicago,Home:America/New_York"
fitz --timezones "Home:Eastern Standard Time,Dream Home:Hawaiian Standard Time"
fitz handles timezones on the command-line almost exactly like gotz with the following syntax: [label:]tz, ...
Whitespace is ignored.
To force your command-line settings to save to your configuration file:
fitz --tics --hours12 --save
See gotz or
fitz --help
- dotnet CLI
- .NET SDK 6
- .NET Runtime 6
The latest versions of .NET can be installed from here. Various package managers also provide dotnet-cli. Note the SDK is usually provided seperately.
- Enter the project directory
dotnet build
dotnet run
Pass command line arguments to fitz directly after the call to run
, e.g. dotnet run --tics --live
.
Usage can be called with dotnet run -- --help
to deconflict with dotnet's help.
Change the configuration to release for better performance, dotnet build -c release
.
fitz has a very similiar configuration layout to gotz. However, fitz uses the FSharp.Json library, which allows more complicated type serialization than the System.Text json serializer and the go standard json encoder. Because of this flexibility, configuration can be simpler.
gotz uses the go tcell package to handle live terminal updates. fitz implements a small terminal cell module with its own SGR style library. This simplifies the colorization configuration -- both the live and static views use the same colors.
An intermediate goal is to use the .NET's XmlSerialization
library to replace json and calls to external packages.
Current default configuration:
{
// Tracks the version of the configuration file (automatic)
"config_version": "1.0.0",
// Configures the timezones to be shown (can be IANA or Microsoft)
"timezones": [
// Timezones have a Label (Name) and Timezone string that evaluates to a timezone id
{
"name": "West Coast",
"timezone": "America/Los_Angeles"
},
{
"name": "Berlin",
"timezone": "Europe/Berlin"
},
{
"name": "New Zealand",
"timezone": "Pacific/Auckland"
}
],
// Configures the style of the plot
"style": {
// Select symbose to use for time blocks ('Mono'|'Rectangles'|'SunMoon')
"symbols": "Rectangles",
// Use coloring or not
"colorize": true,
// Choose which hours to segment the time bars
"day_segments": {
// Hour of the morning to start (0-23)
"morning": 6,
// Hour of the day (business time) to start (0-23)
"day": 8,
// Hour of the evening to start (0-23)
"evening": 18,
// Hour of the night to start (0-23)
"night": 22
},
// Defines the colors for the segments
// Colors can be web-safe color names like "cyan" or "aqua"
// Colors can be hex codes like #00ff00 or #dc143c
"colors": {
// Color of the morning segment
"color_morning": "darkcyan",
// Color of the day segment
"color_day": "cyan",
// Color of the evening segment
"color_evening": "darkcyan",
// Color of the night segment
"color_night": "blue",
// Foreground color that overrides the default console color (optional)
"foreground": "",
// Background color that overrides the default console color (optional)
"background": ""
}
},
// Plot tics on the bottom line for the local time
"tics": false,
// Stretch across the full terminal width
"stretch": false,
// Use a 12-hour format
"hours12": false,
// Plot bars continuously
"live": false
}
- Is this any good?
Yes
- Why is it good?
Because gotz is good.
- Why did you port this?
Mostly practice. I wanted to see if I could get gotz to work seemlessly with f-sharp.
- Which flavor is better? gotz or fitz?
It depends. I do think that fitz has a better live mode and better config support. That said, I think gotz is more performant and you certainly cannot beat the size of go's packaged runtime (3MB < 20MB!). Other than that, they are the same! So it boils down to what tooling and installation methods you prefer.
- Is this cross-platform?
Just to be clear, yes it is (albeit untested on unix-likes).