cli, lib, lang: Port to new cli library

The new version of the urfave/cli library is moving to generics, and
it's completely unclear to me why this is an improvement. Their new API
is very complicated to understand, which for me, defeats the purpose of
golang.

In parallel, I needed to do some upcoming cli API refactoring, so this
was a good time to look into new libraries. After a review of the
landscape, I found the alexflint/go-arg library which has a delightfully
elegant API. It does have a few rough edges, but it's otherwise very
usable, and I think it would be straightforward to add features and fix
issues.

Thanks Alex!
This commit is contained in:
James Shubin
2024-03-01 18:09:06 -05:00
parent e767655ede
commit 589a5f9aeb
32 changed files with 609 additions and 1047 deletions

View File

@@ -29,7 +29,7 @@ import (
)
// New builds a new converger coordinator.
func New(timeout int64) *Coordinator {
func New(timeout int) *Coordinator {
return &Coordinator{
timeout: timeout,
@@ -61,7 +61,7 @@ func New(timeout int64) *Coordinator {
type Coordinator struct {
// timeout must be zero (instant) or greater seconds to run. If it's -1
// then this is disabled, and we never run stateFns.
timeout int64
timeout int
// mutex is used for controlling access to status and lastid.
mutex *sync.RWMutex
@@ -365,7 +365,7 @@ func (obj *Coordinator) Status() map[*UID]bool {
// Timeout returns the timeout in seconds that converger was created with. This
// is useful to avoid passing in the timeout value separately when you're
// already passing in the Coordinator struct.
func (obj *Coordinator) Timeout() int64 {
func (obj *Coordinator) Timeout() int {
return obj.timeout
}
@@ -375,7 +375,7 @@ func (obj *Coordinator) Timeout() int64 {
type UID struct {
// timeout is a copy of the main timeout. It could eventually be used
// for per-UID timeouts too.
timeout int64
timeout int
// isConverged stores the convergence state of this particular UID.
isConverged bool