Skip to content

Commit

Permalink
Merge pull request #44 from ksctl/fix/43
Browse files Browse the repository at this point in the history
Added self update command
  • Loading branch information
dipankardas011 authored Feb 10, 2025
2 parents 046ec7f + c06337f commit 0b53961
Show file tree
Hide file tree
Showing 17 changed files with 377 additions and 19 deletions.
71 changes: 71 additions & 0 deletions cmd/addons.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright 2025 Ksctl 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 cmd

import "github.com/spf13/cobra"

func (k *KsctlCommand) Addons() *cobra.Command {

cmd := &cobra.Command{
Use: "addons",
Example: `
ksctl addons --help
`,
Short: "Use to work with addons",
Long: "It is used to work with addons",
}

return cmd
}

func (k *KsctlCommand) ListAddon() *cobra.Command {

cmd := &cobra.Command{
Use: "list",
Example: `
ksctl addons list --help
`,
Short: "Use to list the addons",
Long: "It is used to list the addons",
}

return cmd
}

func (k *KsctlCommand) EnableAddon() *cobra.Command {

cmd := &cobra.Command{
Use: "enable",
Example: `
ksctl addons enable --help
`,
Short: "Use to enable an addon",
Long: "It is used to enable an addon",
}
return cmd
}

func (k *KsctlCommand) DisableAddon() *cobra.Command {

cmd := &cobra.Command{
Use: "disable",
Example: `
ksctl addons disable --help
`,
Short: "Use to disable an addon",
Long: "It is used to disable an addon",
}
return cmd
}
4 changes: 2 additions & 2 deletions cmd/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"context"
"os"

"github.com/ksctl/cli/pkg/config"
cLogger "github.com/ksctl/cli/pkg/logger"
"github.com/ksctl/cli/v2/pkg/config"
cLogger "github.com/ksctl/cli/v2/pkg/logger"
"github.com/ksctl/ksctl/v2/pkg/consts"
"github.com/ksctl/ksctl/v2/pkg/logger"
"github.com/ksctl/ksctl/v2/pkg/provider"
Expand Down
4 changes: 2 additions & 2 deletions cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"os"
"strconv"

"github.com/ksctl/cli/pkg/cli"
"github.com/ksctl/cli/pkg/config"
"github.com/ksctl/cli/v2/pkg/cli"
"github.com/ksctl/cli/v2/pkg/config"
"github.com/ksctl/ksctl/v2/pkg/consts"
"github.com/ksctl/ksctl/v2/pkg/statefile"
"github.com/ksctl/ksctl/v2/pkg/utilities"
Expand Down
2 changes: 1 addition & 1 deletion cmd/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

"github.com/creack/pty"
"github.com/fatih/color"
"github.com/ksctl/cli/pkg/cli"
"github.com/ksctl/cli/v2/pkg/cli"
"github.com/ksctl/ksctl/v2/pkg/handler/cluster/common"
"github.com/ksctl/ksctl/v2/pkg/handler/cluster/controller"
"github.com/ksctl/ksctl/v2/pkg/logger"
Expand Down
2 changes: 1 addition & 1 deletion cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/ksctl/ksctl/v2/pkg/addons"
"github.com/ksctl/ksctl/v2/pkg/consts"

"github.com/ksctl/cli/pkg/cli"
"github.com/ksctl/cli/v2/pkg/cli"
"github.com/ksctl/ksctl/v2/pkg/handler/cluster/controller"

controllerManaged "github.com/ksctl/ksctl/v2/pkg/handler/cluster/managed"
Expand Down
2 changes: 1 addition & 1 deletion cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"strconv"
"strings"

"github.com/ksctl/cli/pkg/cli"
"github.com/ksctl/cli/v2/pkg/cli"
"github.com/ksctl/ksctl/v2/pkg/consts"
"github.com/ksctl/ksctl/v2/pkg/handler/cluster/controller"
"github.com/ksctl/ksctl/v2/pkg/handler/cluster/managed"
Expand Down
2 changes: 1 addition & 1 deletion cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"strconv"
"strings"

"github.com/ksctl/cli/pkg/cli"
"github.com/ksctl/cli/v2/pkg/cli"
"github.com/ksctl/ksctl/v2/pkg/consts"
"github.com/ksctl/ksctl/v2/pkg/logger"
"github.com/ksctl/ksctl/v2/pkg/provider"
Expand Down
2 changes: 1 addition & 1 deletion cmd/handle_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"os"
"strconv"

"github.com/ksctl/cli/pkg/cli"
"github.com/ksctl/cli/v2/pkg/cli"
"github.com/ksctl/ksctl/v2/pkg/consts"
"github.com/ksctl/ksctl/v2/pkg/handler/cluster/controller"
controllerMeta "github.com/ksctl/ksctl/v2/pkg/handler/cluster/metadata"
Expand Down
12 changes: 11 additions & 1 deletion cmd/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@

package cmd

import "github.com/ksctl/cli/pkg/cli"
import "github.com/ksctl/cli/v2/pkg/cli"

func (k *KsctlCommand) CommandMapping() error {
c := k.Cluster()
cr := k.Configure()
cl := k.List()
a := k.Addons()

cli.RegisterCommand(
k.root,
c,
k.Version(),
k.SelfUpdate(),
cr,
a,
)
cli.RegisterCommand(
c,
Expand All @@ -49,5 +52,12 @@ func (k *KsctlCommand) CommandMapping() error {
k.ConfigureCloud(),
)

cli.RegisterCommand(
a,
k.EnableAddon(),
k.DisableAddon(),
k.ListAddon(),
)

return nil
}
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
"context"
"os"

"github.com/ksctl/cli/pkg/cli"
"github.com/ksctl/cli/v2/pkg/cli"
"github.com/ksctl/ksctl/v2/pkg/consts"

cLogger "github.com/ksctl/cli/pkg/logger"
cLogger "github.com/ksctl/cli/v2/pkg/logger"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"os"
"strconv"

"github.com/ksctl/cli/pkg/cli"
"github.com/ksctl/cli/v2/pkg/cli"
"github.com/ksctl/ksctl/v2/pkg/consts"
"github.com/ksctl/ksctl/v2/pkg/handler/cluster/controller"
"github.com/ksctl/ksctl/v2/pkg/handler/cluster/selfmanaged"
Expand Down
Loading

0 comments on commit 0b53961

Please sign in to comment.