TanmoySG / wunderDB

A micro JSON-based Data Store inspired by MongoDB.
http://wdb.tanmoysg.com/api/
Apache License 2.0
12 stars 0 forks source link

[💻 Development] Basic `wdbctl` CLI tool to start/handle WDB instances locally #34

Closed TanmoySG closed 1 year ago

TanmoySG commented 1 year ago

Create a basic CLI tool wdbctl or wdbcli for wunderDb. The CLI tool will function as the primary interactive command-based tool for wdb (other than docker, when published) and will be expanded to add other bunch of features, including a CLI based data CRUD ops, etc.

In this Issue, setup initial framework for the cli tool that can,

Some Libraries that can be used

TanmoySG commented 1 year ago

Some Guides

TanmoySG commented 1 year ago

https://dev.to/aurelievache/learning-go-by-examples-part-9-use-homebrew-goreleaser-for-distributing-a-golang-app-44ae

TanmoySG commented 1 year ago
TanmoySG commented 1 year ago
TanmoySG commented 1 year ago
TanmoySG commented 1 year ago

For 1, some suggestions here: https://www.reddit.com/r/golang/comments/cs5xh4/basic_data_storage_for_a_go_cli_app/ Depending on which config parser and CLI handler lib you're using (https://cli.urfave.org/ is used by Benthos, https://github.com/spf13/viper combined with https://cobra.dev/ is very old but still popular and has a WriteConfig method, and there are some new ones like https://github.com/segmentio/cli, https://github.com/rwxrob/bonzai, https://github.com/sethvargo/go-envconfig that I haven't looked at yet). For fetching the location of where to write state, maybe start with https://pkg.go.dev/os#UserHomeDir and look for libraries which build on top of it if you need something fancier...

For 2, yeah, for sure! I don't really know what you mean by "go get installs the library" since Go libraries don't get "installed". You import them as code via go get (and go tidy to make sure go.sum is clean). If your repo also happens to have a ./cli/foobar main package with a whatever.go that has a func main, then you can use go install to install it as an executable (in the past, go get was used for this, but the install functionality has been deprecated. See here https://go.dev/doc/go-get-install-deprecation). Note that go install requires you to use the @ character followed by a valid semver tag or latest (you can also run go install from the current workspace via go install example.com/cmd like mentioned in the article, but you usually don't need to do that, since you want to install tagged releases).