about summary refs log tree commit diff
path: root/users/fcuny/exp/buckit
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2021-03-29 20:01:11 -0700
committerFranck Cuny <franck@fcuny.net>2022-06-13 17:20:37 -0700
commit962d03ca2893c7ca78f2beb497633190575a148a (patch)
tree2722b795f1dfe385cf1e1ec16c5cf5839abea6bb /users/fcuny/exp/buckit
parentgit: ignore the generated binary buckit (diff)
downloadworld-962d03ca2893c7ca78f2beb497633190575a148a.tar.gz
add stub commands for buckit
Add the stub commands for the binary. Each command will be in its own
file (with the exception of delete/un-delete). This will make it easier
to navigate the code.

We use `github/urfave/cli` for generating the sub commands, as the
module is well documented and easy to use.
Diffstat (limited to 'users/fcuny/exp/buckit')
-rw-r--r--users/fcuny/exp/buckit/add.go16
-rw-r--r--users/fcuny/exp/buckit/delete.go27
-rw-r--r--users/fcuny/exp/buckit/fetch.go16
-rw-r--r--users/fcuny/exp/buckit/go.mod5
-rw-r--r--users/fcuny/exp/buckit/go.sum13
-rw-r--r--users/fcuny/exp/buckit/info.go16
-rw-r--r--users/fcuny/exp/buckit/list.go16
-rw-r--r--users/fcuny/exp/buckit/main.go21
8 files changed, 130 insertions, 0 deletions
diff --git a/users/fcuny/exp/buckit/add.go b/users/fcuny/exp/buckit/add.go
new file mode 100644
index 0000000..32f5870
--- /dev/null
+++ b/users/fcuny/exp/buckit/add.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+	"github.com/urfave/cli/v2"
+)
+
+var addCmd = &cli.Command{
+	Name:      "add",
+	Usage:     "Add a file to a namespace",
+	Action:    addAction,
+	ArgsUsage: "<namespace> <file> <filepath>",
+}
+
+func addAction(ctx *cli.Context) error {
+	return nil
+}
diff --git a/users/fcuny/exp/buckit/delete.go b/users/fcuny/exp/buckit/delete.go
new file mode 100644
index 0000000..6e504a9
--- /dev/null
+++ b/users/fcuny/exp/buckit/delete.go
@@ -0,0 +1,27 @@
+package main
+
+import (
+	"github.com/urfave/cli/v2"
+)
+
+var deleteCmd = &cli.Command{
+	Name:      "delete",
+	Usage:     "Delete a version of a file within a namespace",
+	Action:    deleteAction,
+	ArgsUsage: "<namespace> <file> <version>",
+}
+
+var undeleteCmd = &cli.Command{
+	Name:      "undelete",
+	Usage:     "Un-delete a version of a file within a namespace",
+	Action:    undeleteAction,
+	ArgsUsage: "<namespace> <file> <version>",
+}
+
+func deleteAction(ctx *cli.Context) error {
+	return nil
+}
+
+func undeleteAction(ctx *cli.Context) error {
+	return nil
+}
diff --git a/users/fcuny/exp/buckit/fetch.go b/users/fcuny/exp/buckit/fetch.go
new file mode 100644
index 0000000..9ac31cc
--- /dev/null
+++ b/users/fcuny/exp/buckit/fetch.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+	"github.com/urfave/cli/v2"
+)
+
+var fetchCmd = &cli.Command{
+	Name:      "fetch",
+	Usage:     "Fetch a version of a file within a namespace",
+	Action:    fetchAction,
+	ArgsUsage: "<namespace> <file> <version>",
+}
+
+func fetchAction(ctx *cli.Context) error {
+	return nil
+}
diff --git a/users/fcuny/exp/buckit/go.mod b/users/fcuny/exp/buckit/go.mod
new file mode 100644
index 0000000..d0b3c3e
--- /dev/null
+++ b/users/fcuny/exp/buckit/go.mod
@@ -0,0 +1,5 @@
+module github.com/fcuny/buckit
+
+go 1.16
+
+require github.com/urfave/cli/v2 v2.3.0
diff --git a/users/fcuny/exp/buckit/go.sum b/users/fcuny/exp/buckit/go.sum
new file mode 100644
index 0000000..f8207d7
--- /dev/null
+++ b/users/fcuny/exp/buckit/go.sum
@@ -0,0 +1,13 @@
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
+github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
+github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
+github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
+github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
+github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/users/fcuny/exp/buckit/info.go b/users/fcuny/exp/buckit/info.go
new file mode 100644
index 0000000..a75add4
--- /dev/null
+++ b/users/fcuny/exp/buckit/info.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+	"github.com/urfave/cli/v2"
+)
+
+var infoCmd = &cli.Command{
+	Name:      "info",
+	Usage:     "Get information about a version of a file in a namespace",
+	Action:    infoAction,
+	ArgsUsage: "<namespace> <file> <version>",
+}
+
+func infoAction(ctx *cli.Context) error {
+	return nil
+}
diff --git a/users/fcuny/exp/buckit/list.go b/users/fcuny/exp/buckit/list.go
new file mode 100644
index 0000000..5d81c34
--- /dev/null
+++ b/users/fcuny/exp/buckit/list.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+	"github.com/urfave/cli/v2"
+)
+
+var listCmd = &cli.Command{
+	Name:      "list",
+	Usage:     "List namespaces or files within a namespace",
+	Action:    listAction,
+	ArgsUsage: "[namespace]",
+}
+
+func listAction(ctx *cli.Context) error {
+	return nil
+}
diff --git a/users/fcuny/exp/buckit/main.go b/users/fcuny/exp/buckit/main.go
new file mode 100644
index 0000000..2350264
--- /dev/null
+++ b/users/fcuny/exp/buckit/main.go
@@ -0,0 +1,21 @@
+package main
+
+import (
+	"os"
+
+	"github.com/urfave/cli/v2"
+)
+
+func main() {
+	app := cli.NewApp()
+	app.Name = "buckit"
+	app.Commands = []*cli.Command{
+		addCmd,
+		listCmd,
+		fetchCmd,
+		infoCmd,
+		deleteCmd,
+		undeleteCmd,
+	}
+	app.Run(os.Args)
+}