I’ve been maintaining rust-starter[!] for quite sometime now. It is kind of the equivalent of fang but for Rust. It uses Clap which is the equivalent of Cobra; though I don’t think Clap has the same kind of fancy output? Throughout these years, I have found that cross-compiling is the most challenging part of creating a CLI. When you are building a web back-end, you control the execution environment (usually linux).…
Golang itself bundles a toolchain and can cross compile to a many target OSes and architectures. I use Goreleaser [1] to create GitHub releases, Homebrew packages, Docker images, and Linux packages. Goreleaser Pro can also create MSI packages. ETA since I just saw Christian chime in: the Goreleaser author works at Charm.sh =) [1] https://goreleaser.com
Fang, the CLI Starter Kit
11–20 of 34 posts
Re: Fang, the CLI Starter Kit
#12I’ve been maintaining rust-starter[!] for quite sometime now. It is kind of the equivalent of fang but for Rust. It uses Clap which is the equivalent of Cobra; though I don’t think Clap has the same kind of fancy output? Throughout these years, I have found that cross-compiling is the most challenging part of creating a CLI. When you are building a web back-end, you control the execution environment (usually linux).…
Re: Fang, the CLI Starter Kit
#13I’ve been maintaining rust-starter[!] for quite sometime now. It is kind of the equivalent of fang but for Rust. It uses Clap which is the equivalent of Cobra; though I don’t think Clap has the same kind of fancy output? Throughout these years, I have found that cross-compiling is the most challenging part of creating a CLI. When you are building a web back-end, you control the execution environment (usually linux).…
Wow TIL cross compilation is a bit of a pain in Rust. I assumed it was as easy as Go. I can confirm as long as you're using pure Go (no cgo), it's as easy as setting $GOOS and $GOARCH appropriately.
That said, I am unfamiliar with any licensing for Windows builds.
MacOS has some niche (usually discarded) technicalities like you can only use the SDK on Apple hardware.
Re: Fang, the CLI Starter Kit
#14I’ve been maintaining rust-starter[!] for quite sometime now. It is kind of the equivalent of fang but for Rust. It uses Clap which is the equivalent of Cobra; though I don’t think Clap has the same kind of fancy output? Throughout these years, I have found that cross-compiling is the most challenging part of creating a CLI. When you are building a web back-end, you control the execution environment (usually linux).…
Golang itself bundles a toolchain and can cross compile to a many target OSes and architectures. I use Goreleaser [1] to create GitHub releases, Homebrew packages, Docker images, and Linux packages. Goreleaser Pro can also create MSI packages. ETA since I just saw Christian chime in: the Goreleaser author works at Charm.sh =) [1] https://goreleaser.com
And actually Carlos, who builds GoReleaser, is the true author of Fang and took it from concept to execution.
Re: Fang, the CLI Starter Kit
#15This is awesome! Love the work the charm bracelet team is doing.
Re: Fang, the CLI Starter Kit
#16Earlier quoted context omitted.
Wow TIL cross compilation is a bit of a pain in Rust. I assumed it was as easy as Go. I can confirm as long as you're using pure Go (no cgo), it's as easy as setting $GOOS and $GOARCH appropriately.
The difficulty is due to Rust dynamically linking and Go statically linking. The former requires the system libs. That said, I am unfamiliar with any licensing for Windows builds. MacOS has some niche (usually discarded) technicalities like you can only use the SDK on Apple hardware.
Re: Fang, the CLI Starter Kit
#17Stubborn complaint (and maybe a hot take): I dislike CLIs that try to be overly pretty. I don't receive any tangible benefit as the user from the "fancy" (their words) help output. I'd much rather simple plain text output that looks like all the other tools I already use.
Re: Fang, the CLI Starter Kit
#18Stubborn complaint (and maybe a hot take): I dislike CLIs that try to be overly pretty. I don't receive any tangible benefit as the user from the "fancy" (their words) help output. I'd much rather simple plain text output that looks like all the other tools I already use.
agreed, plain text is more scriptable too. Let me pipe it into awk!
Re: Fang, the CLI Starter Kit
#19Stubborn complaint (and maybe a hot take): I dislike CLIs that try to be overly pretty. I don't receive any tangible benefit as the user from the "fancy" (their words) help output. I'd much rather simple plain text output that looks like all the other tools I already use.
One of the downsides of a lot of these tools is that's exactly what they don't do well: many things don't align or wrap nicely.
For example, here's a comparison of this fang library vs one where I just raw-dogged the usage text: https://imgur.com/a/QWh9TLD – the nice alignment does a lot more than colours. Especially for larger programs with a bunch of flags it can be such a pain. For example from an otherwise quite nice tool: https://imgur.com/a/RELL9Gk – you just completely lose any "overview".
I did spend some time on some better tooling to improve all of this, because manually writing these isn't super-fun either, but not so straight-forward to do well (or at least: not in a way that I like).
Re: Fang, the CLI Starter Kit
#20Earlier quoted context omitted.
agreed, plain text is more scriptable too. Let me pipe it into awk!
If you do it right, you can output plain text when stdout is not a tty - which is something fang does, fwiw :)