Skip to content

Commit

Permalink
feature(main): add cepctl feature
Browse files Browse the repository at this point in the history
  • Loading branch information
cuisongliu committed Jan 21, 2022
1 parent 6ab370c commit 6e19098
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 3 deletions.
17 changes: 16 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,22 @@ builds:
goarch:
- amd64
- arm64
main: ./cmd
main: ./cmd/endpoints-operator
ldflags:
- -X github.com/sealyun/endpoints-operator/library/version.gitVersion={{.Version}}
- -X github.com/sealyun/endpoints-operator/library/version.gitCommit={{.ShortCommit}}
- -X github.com/sealyun/endpoints-operator/library/version.buildDate={{.Date}}
- -s -w
- env:
- CGO_ENABLED=0
id: cepctl
goos:
- linux
- darwin
goarch:
- amd64
- arm64
main: ./cmd/cepctl
ldflags:
- -X github.com/sealyun/endpoints-operator/library/version.gitVersion={{.Version}}
- -X github.com/sealyun/endpoints-operator/library/version.gitCommit={{.ShortCommit}}
Expand Down
41 changes: 41 additions & 0 deletions cmd/cepctl/app/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright 2022 The sealyun Authors.
Licensed 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 app

import (
"fmt"
"github.com/spf13/cobra"
"os"
)

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "cepctl",
Short: "cepctl is cli for cluster-endpoint",
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) { },
}

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
26 changes: 26 additions & 0 deletions cmd/cepctl/cepctl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright 2022 The sealyun Authors.
Licensed 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 (
"github.com/sealyun/endpoints-operator/cmd/cepctl/app"
)

func main() {

app.Execute()
}
File renamed without changes.
2 changes: 1 addition & 1 deletion cmd/app/server.go → cmd/endpoints-operator/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ package app
import (
"context"
"fmt"
"github.com/sealyun/endpoints-operator/cmd/endpoints-operator/app/options"
"github.com/sealyun/endpoints-operator/controllers"
"k8s.io/component-base/term"
"net/http"
"os"

"github.com/sealyun/endpoints-operator/cmd/app/options"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/runtime"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package main

import (
"github.com/sealyun/endpoints-operator/cmd/app"
"github.com/sealyun/endpoints-operator/cmd/endpoints-operator/app"
"os"
)

Expand Down

0 comments on commit 6e19098

Please sign in to comment.