-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from inksnw/master
Simplify the logic of creating extensions
- Loading branch information
Showing
41 changed files
with
1,133 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,4 @@ coverage.out | |
/dist | ||
|
||
.envrc | ||
/ksbuilder | ||
/ksbuilder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"github.com/kubesphere/ksbuilder/pkg/extension" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
type createAppOptions struct { | ||
from string | ||
} | ||
|
||
func createAppExtensionCmd() *cobra.Command { | ||
o := &createAppOptions{} | ||
|
||
cmd := &cobra.Command{ | ||
Use: "createapp", | ||
Short: "Create a new KubeSphere extension with a chart file to appstore", | ||
Args: cobra.ExactArgs(0), | ||
RunE: o.run, | ||
} | ||
cmd.Flags().StringVar(&o.from, "from", "", "helm chart file") | ||
|
||
return cmd | ||
} | ||
|
||
func (o *createAppOptions) run(_ *cobra.Command, _ []string) error { | ||
if o.from == "" { | ||
return fmt.Errorf("must specify a helm chart file with --from") | ||
} | ||
if err := extension.CreateApp(o.from); err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"github.com/kubesphere/ksbuilder/pkg/extension" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
type createSimpleOptions struct { | ||
from string | ||
} | ||
|
||
func createSimpleExtensionCmd() *cobra.Command { | ||
o := &createSimpleOptions{} | ||
|
||
cmd := &cobra.Command{ | ||
Use: "createsimple", | ||
Short: "Create a new KubeSphere extension with a chart file", | ||
Args: cobra.ExactArgs(0), | ||
RunE: o.run, | ||
} | ||
cmd.Flags().StringVar(&o.from, "from", "", "helm chart file") | ||
|
||
return cmd | ||
} | ||
|
||
func (o *createSimpleOptions) run(_ *cobra.Command, _ []string) error { | ||
if o.from == "" { | ||
return fmt.Errorf("must specify a helm chart file with --from") | ||
} | ||
if err := extension.CreateSimple(o.from); err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.