You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/02/08 02:34:30 UTC

[shardingsphere-on-cloud] branch main updated: feat: init pitr cli project (#193)

This is an automated email from the ASF dual-hosted git repository.

zhaojinchao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shardingsphere-on-cloud.git


The following commit(s) were added to refs/heads/main by this push:
     new 8d9b753  feat: init pitr cli project (#193)
8d9b753 is described below

commit 8d9b753f81fc714a048501eb286b4c8f4d469fc4
Author: lltgo <ll...@outlook.com>
AuthorDate: Wed Feb 8 10:34:26 2023 +0800

    feat: init pitr cli project (#193)
---
 pitr/cli/Makefile                             |  4 +++
 pitr/cli/README.md                            | 20 +++++++++++++
 pitr/cli/go.mod                               |  9 ++++++
 pitr/cli/go.sum                               | 10 +++++++
 pitr/cli/internal/cmd/backup.go               | 20 +++++++++++++
 pitr/cli/internal/cmd/resotre.go              | 20 +++++++++++++
 pitr/cli/internal/cmd/show.go                 | 20 +++++++++++++
 pitr/cli/internal/cmd/view/.gitkeep           |  0
 pitr/cli/internal/pkg/agent-server.go         | 20 +++++++++++++
 pitr/cli/internal/pkg/model/.gitkeep          |  0
 pitr/cli/internal/pkg/shardingsphere-proxy.go | 20 +++++++++++++
 pitr/cli/main.go                              | 42 +++++++++++++++++++++++++++
 12 files changed, 185 insertions(+)

diff --git a/pitr/cli/Makefile b/pitr/cli/Makefile
new file mode 100644
index 0000000..db92ecc
--- /dev/null
+++ b/pitr/cli/Makefile
@@ -0,0 +1,4 @@
+.PHONY: build
+
+build:
+	go build -o gs_pitr main.go
\ No newline at end of file
diff --git a/pitr/cli/README.md b/pitr/cli/README.md
new file mode 100644
index 0000000..0115d1b
--- /dev/null
+++ b/pitr/cli/README.md
@@ -0,0 +1,20 @@
+# PITR/CLI
+
+PITR cli client for openGauss.
+
+## project description
+
+### layout
+
+* `internal`:For internal code, use golang internal directory to isolate references.
+    - `cmd`: All subcommands.
+        - `view`: Cli output structure.
+        - `backup.go`: `backup` subcommand.
+        - `restore.go`: `restore` subcommand.
+        - `show.go`: `show` subcommand.
+    - `pkg`: Third party dependencies.
+        - `model`: Input/Output structure.
+        - `agent-server.go`: Agent server API.
+        - `sharding-sphere-proxy.go`: Sharding-sphere proxy API.
+* `main.go`: Golang main function.
+
diff --git a/pitr/cli/go.mod b/pitr/cli/go.mod
new file mode 100644
index 0000000..18dea94
--- /dev/null
+++ b/pitr/cli/go.mod
@@ -0,0 +1,9 @@
+module github.com/apache/pitr/cli
+
+go 1.20
+
+require (
+	github.com/inconshreveable/mousetrap v1.0.1 // indirect
+	github.com/spf13/cobra v1.6.1 // indirect
+	github.com/spf13/pflag v1.0.5 // indirect
+)
diff --git a/pitr/cli/go.sum b/pitr/cli/go.sum
new file mode 100644
index 0000000..442875a
--- /dev/null
+++ b/pitr/cli/go.sum
@@ -0,0 +1,10 @@
+github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
+github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
+github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
+github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
+github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
+github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
+github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/pitr/cli/internal/cmd/backup.go b/pitr/cli/internal/cmd/backup.go
new file mode 100644
index 0000000..77b643e
--- /dev/null
+++ b/pitr/cli/internal/cmd/backup.go
@@ -0,0 +1,20 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+package cmd
+
+//TODO
diff --git a/pitr/cli/internal/cmd/resotre.go b/pitr/cli/internal/cmd/resotre.go
new file mode 100644
index 0000000..77b643e
--- /dev/null
+++ b/pitr/cli/internal/cmd/resotre.go
@@ -0,0 +1,20 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+package cmd
+
+//TODO
diff --git a/pitr/cli/internal/cmd/show.go b/pitr/cli/internal/cmd/show.go
new file mode 100644
index 0000000..77b643e
--- /dev/null
+++ b/pitr/cli/internal/cmd/show.go
@@ -0,0 +1,20 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+package cmd
+
+//TODO
diff --git a/pitr/cli/internal/cmd/view/.gitkeep b/pitr/cli/internal/cmd/view/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/pitr/cli/internal/pkg/agent-server.go b/pitr/cli/internal/pkg/agent-server.go
new file mode 100644
index 0000000..a21fd42
--- /dev/null
+++ b/pitr/cli/internal/pkg/agent-server.go
@@ -0,0 +1,20 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+package pkg
+
+//TODO
diff --git a/pitr/cli/internal/pkg/model/.gitkeep b/pitr/cli/internal/pkg/model/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/pitr/cli/internal/pkg/shardingsphere-proxy.go b/pitr/cli/internal/pkg/shardingsphere-proxy.go
new file mode 100644
index 0000000..a21fd42
--- /dev/null
+++ b/pitr/cli/internal/pkg/shardingsphere-proxy.go
@@ -0,0 +1,20 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+package pkg
+
+//TODO
diff --git a/pitr/cli/main.go b/pitr/cli/main.go
new file mode 100644
index 0000000..1055512
--- /dev/null
+++ b/pitr/cli/main.go
@@ -0,0 +1,42 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+ */
+
+package main
+
+import (
+	"fmt"
+
+	"github.com/spf13/cobra"
+)
+
+var rootCmd = &cobra.Command{
+	Use:   "gs_pitr",
+	Short: "PITR tools for openGauss",
+	Run: func(cmd *cobra.Command, args []string) {
+		fmt.Println("Did nothing...")
+	},
+	CompletionOptions: cobra.CompletionOptions{
+		DisableDefaultCmd: true,
+		HiddenDefaultCmd:  true,
+	},
+}
+
+func main() {
+	if err := rootCmd.Execute(); err != nil {
+		fmt.Println(fmt.Sprintf("Err: %s", err))
+	}
+}