Skip to content

Commit

Permalink
Refactor the cli functions to use urfave/cli instead of cobra.
Browse files Browse the repository at this point in the history
Viper is replaced by urfave/cli atlsrc

A few variable have been renamed to match, e.g.
cfg.CtrKernelSnapshotter to match defaults.ContainerdKernelSnapshotter

Signed-off-by: Soule BA <soule@weave.works>
  • Loading branch information
souleb authored and vagrant committed Nov 5, 2021
1 parent 1f0a587 commit 72e14fa
Show file tree
Hide file tree
Showing 12 changed files with 340 additions and 528 deletions.
6 changes: 3 additions & 3 deletions cmd/dev-helper/main.go
Expand Up @@ -79,12 +79,12 @@ func runCreateVMPlanTest(ctx context.Context, nodeNum int, sshKey string, logger
},
GRPCAPIEndpoint: "",
HTTPAPIEndpoint: "",
CtrSnapshotterKernel: defaults.ContainerdKernelSnapshotter,
CtrSnapshotterVolume: defaults.ContainerdVolumeSnapshotter,
CtrKernelSnapshotter: defaults.ContainerdKernelSnapshotter,
CtrVolumeSnapshotter: defaults.ContainerdVolumeSnapshotter,
CtrSocketPath: socketPath,
CtrNamespace: defaults.ContainerdNamespace,
FirecrackerBin: "/home/richard/bin/firecracker",
FirecrackerDetatch: false,
FirecrackerDetach: false,
FirecrackerUseAPI: true,
StateRootDir: defaults.StateRootDir,
ParentIface: "enp1s0",
Expand Down
13 changes: 6 additions & 7 deletions cmd/flintlockd/main.go
@@ -1,18 +1,17 @@
package main

import (
"log"
"fmt"
"os"

"github.com/weaveworks/flintlock/internal/command"
)

func main() {
rootCmd, err := command.NewRootCommand()
if err != nil {
log.Fatalln(err)
}
app := command.NewApp()

if err := rootCmd.Execute(); err != nil {
log.Fatalln(err)
if err := app.Run(os.Args); err != nil {
fmt.Fprintf(os.Stderr, "flintlockd: %s\n", err)
os.Exit(1)
}
}
27 changes: 8 additions & 19 deletions go.mod
Expand Up @@ -7,7 +7,7 @@ replace github.com/weaveworks/flintlock/api => ./api
require (
github.com/Microsoft/go-winio v0.5.0 // indirect
// github.com/weaveworks/flintlock/api TO_ADD
github.com/containerd/containerd v1.5.7
github.com/containerd/containerd v1.5.0-rc.0
github.com/containerd/typeurl v1.0.2
github.com/firecracker-microvm/firecracker-go-sdk v0.22.0
github.com/go-openapi/strfmt v0.19.5
Expand All @@ -27,10 +27,8 @@ require (
github.com/prometheus/client_golang v1.11.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/afero v1.6.0
github.com/spf13/cobra v1.2.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.9.0
github.com/stretchr/testify v1.7.0
github.com/urfave/cli/v2 v2.3.0
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852
github.com/weaveworks/flintlock/api v0.0.0-00010101000000-000000000000
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
Expand All @@ -40,7 +38,8 @@ require (
)

require (
github.com/Microsoft/hcsshim v0.8.21 // indirect
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/Microsoft/hcsshim v0.8.16 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect
Expand All @@ -52,7 +51,8 @@ require (
github.com/containerd/fifo v1.0.0 // indirect
github.com/containerd/ttrpc v1.0.2 // indirect
github.com/containernetworking/cni v0.8.1 // indirect
github.com/containernetworking/plugins v0.9.1 // indirect
github.com/containernetworking/plugins v0.8.7 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
Expand All @@ -74,43 +74,32 @@ require (
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/subcommands v1.0.1 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mailru/easyjson v0.7.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/sys/mountinfo v0.4.1 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/opencontainers/runc v1.0.2 // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
github.com/opencontainers/selinux v1.8.2 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.26.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae // indirect
go.mongodb.org/mongo-driver v1.5.1 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/tools v0.1.5 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/genproto v0.0.0-20211021150943-2b146023228c // indirect
gopkg.in/ini.v1 v1.63.2 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

0 comments on commit 72e14fa

Please sign in to comment.