Skip to content

Commit 878a8d9

Browse files
author
Tiexin Guo
authored
Merge pull request #601 from devstream-io/main
Merge latest main to release-0.6 for docs update
2 parents 33b7939 + 99bf60b commit 878a8d9

38 files changed

+329
-41
lines changed

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
SELF_DIR=$(dir $(lastword $(MAKEFILE_LIST)))
3-
42
GOOS=$(shell go env GOOS)
3+
GOPATH=$(shell go env GOPATH)
54
GOARCH=$(shell go env GOARCH)
65
GO_PLUGIN_BUILD=go build -buildmode=plugin -trimpath -gcflags="all=-N -l"
76
PLUGINS=$(notdir $(wildcard $(ROOT_DIR)/cmd/plugin/*))
@@ -76,9 +75,9 @@ md5-plugin.%:
7675
.PHONY: fmt
7776
fmt: ## Run 'go fmt' & goimports against code.
7877
@echo ">>>>>>>>>>>> Formating codes"
79-
@go install golang.org/x/tools/cmd/goimports@latest
78+
@[[ -e ${GOPATH}/bin/goimports ]] || (echo "installing goimports ..." && go install golang.org/x/tools/cmd/goimports@latest)
8079
@$(FIND) -type f | xargs gofmt -s -w
81-
@$(FIND) -type f | xargs goimports -w -local $(DTM_ROOT)
80+
@$(FIND) -type f | xargs ${GOPATH}/bin/goimports -w -local $(DTM_ROOT)
8281

8382
.PHONY: vet
8483
vet: ## Run "go vet ./...".

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
TL;DR: DevStream (CLI tool named `dtm`) is an open-source DevOps toolchain manager.
2222

23+
[v0.6.0 Demo](https://www.youtube.com/watch?v=q7TK3vFr1kg)
24+
2325
Imagine you are starting a new project or ramping up a new team. Before writing the first line of code, you have to figure out the tools to run an effective SDLC process and from development to deployment.
2426

2527
Typically, you'd need the following pieces in place to work effectively:

cmd/devstream/apply.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ func applyCMDFunc(cmd *cobra.Command, args []string) {
2525
}
2626
log.Success("Apply finished.")
2727
}
28+
func init() {
29+
applyCMD.Flags().StringVarP(&configFile, "config-file", "f", "config.yaml", "config file")
30+
applyCMD.Flags().StringVarP(&pluginDir, "plugin-dir", "d", pluginengine.DefaultPluginDir, "plugins directory")
31+
applyCMD.Flags().BoolVarP(&continueDirectly, "yes", "y", false, "apply directly without confirmation")
32+
}

cmd/devstream/common.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
var (
4+
configFile string
5+
pluginDir string
6+
continueDirectly bool
7+
)

cmd/devstream/delete.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"github.com/devstream-io/devstream/pkg/util/log"
1010
)
1111

12+
var isForceDelete bool
13+
1214
var deleteCMD = &cobra.Command{
1315
Use: "delete",
1416
Short: "Delete DevOps tools according to DevStream configuration file",
@@ -28,5 +30,8 @@ func deleteCMDFunc(cmd *cobra.Command, args []string) {
2830
}
2931

3032
func init() {
31-
deleteCMD.PersistentFlags().BoolVarP(&isForceDelete, "force", "", false, "force delete by config")
33+
deleteCMD.Flags().BoolVarP(&isForceDelete, "force", "", false, "force delete by config")
34+
deleteCMD.Flags().StringVarP(&configFile, "config-file", "f", "config.yaml", "config file")
35+
deleteCMD.Flags().StringVarP(&pluginDir, "plugin-dir", "d", pluginengine.DefaultPluginDir, "plugins directory")
36+
deleteCMD.Flags().BoolVarP(&continueDirectly, "yes", "y", false, "delete directly without confirmation")
3237
}

cmd/devstream/destroy.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ func destroyCMDFunc(cmd *cobra.Command, args []string) {
2424
}
2525
log.Success("Destroy finished.")
2626
}
27+
28+
func init() {
29+
destroyCMD.Flags().StringVarP(&configFile, "config-file", "f", "config.yaml", "config file")
30+
destroyCMD.Flags().BoolVarP(&continueDirectly, "yes", "y", false, "destroy directly without confirmation")
31+
}

cmd/devstream/init.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/spf13/cobra"
55

66
"github.com/devstream-io/devstream/internal/pkg/configloader"
7+
"github.com/devstream-io/devstream/internal/pkg/pluginengine"
78
"github.com/devstream-io/devstream/internal/pkg/pluginmanager"
89
"github.com/devstream-io/devstream/pkg/util/log"
910
)
@@ -30,3 +31,8 @@ func initCMDFunc(cmd *cobra.Command, args []string) {
3031

3132
log.Success("Initialize finished.")
3233
}
34+
35+
func init() {
36+
initCMD.Flags().StringVarP(&configFile, "config-file", "f", "config.yaml", "config file")
37+
initCMD.Flags().StringVarP(&pluginDir, "plugin-dir", "d", pluginengine.DefaultPluginDir, "plugins directory")
38+
}

cmd/devstream/main.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,11 @@ import (
77
"github.com/spf13/cobra"
88
"github.com/spf13/viper"
99

10-
"github.com/devstream-io/devstream/internal/pkg/pluginengine"
1110
"github.com/devstream-io/devstream/pkg/util/log"
1211
)
1312

1413
var (
15-
configFile string
16-
pluginDir string
17-
continueDirectly bool
18-
isDebug bool
19-
isForceDelete bool
20-
14+
isDebug bool
2115
rootCMD = &cobra.Command{
2216
Use: "dtm",
2317
Short: `DevStream is an open-source DevOps toolchain manager`,
@@ -39,10 +33,6 @@ var (
3933

4034
func init() {
4135
cobra.OnInitialize(initConfig)
42-
43-
rootCMD.PersistentFlags().StringVarP(&configFile, "config-file", "f", "config.yaml", "config file")
44-
rootCMD.PersistentFlags().StringVarP(&pluginDir, "plugin-dir", "d", pluginengine.DefaultPluginDir, "plugins directory")
45-
rootCMD.PersistentFlags().BoolVarP(&continueDirectly, "yes", "y", false, "apply/delete directly without confirmation")
4636
rootCMD.PersistentFlags().BoolVarP(&isDebug, "debug", "", false, "debug level log")
4737
rootCMD.AddCommand(versionCMD)
4838
rootCMD.AddCommand(initCMD)
@@ -90,6 +80,9 @@ func initConfig() {
9080
if err := viper.BindPFlags(showStatusCMD.Flags()); err != nil {
9181
log.Fatal(err)
9282
}
83+
if err := viper.BindPFlags(initCMD.Flags()); err != nil {
84+
log.Fatal(err)
85+
}
9386
}
9487

9588
func initLog() {

cmd/devstream/show.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"github.com/spf13/cobra"
55

6+
"github.com/devstream-io/devstream/internal/pkg/pluginengine"
67
"github.com/devstream-io/devstream/internal/pkg/show/config"
78
"github.com/devstream-io/devstream/internal/pkg/show/status"
89
"github.com/devstream-io/devstream/pkg/util/log"
@@ -56,8 +57,11 @@ func init() {
5657
showCMD.AddCommand(showConfigCMD)
5758
showCMD.AddCommand(showStatusCMD)
5859

59-
showConfigCMD.PersistentFlags().StringVarP(&plugin, "plugin", "p", "", "specify name with the plugin")
60-
showStatusCMD.PersistentFlags().StringVarP(&plugin, "plugin", "p", "", "specify name with the plugin")
61-
showStatusCMD.PersistentFlags().StringVarP(&instanceID, "id", "i", "", "specify id with the plugin instance")
62-
showStatusCMD.PersistentFlags().BoolVarP(&statusAllFlag, "all", "a", false, "show all instances of all plugins status")
60+
showConfigCMD.Flags().StringVarP(&plugin, "plugin", "p", "", "specify name with the plugin")
61+
62+
showStatusCMD.Flags().StringVarP(&plugin, "plugin", "p", "", "specify name with the plugin")
63+
showStatusCMD.Flags().StringVarP(&instanceID, "id", "i", "", "specify id with the plugin instance")
64+
showStatusCMD.Flags().BoolVarP(&statusAllFlag, "all", "a", false, "show all instances of all plugins status")
65+
showStatusCMD.Flags().StringVarP(&pluginDir, "plugin-dir", "d", pluginengine.DefaultPluginDir, "plugins directory")
66+
showStatusCMD.Flags().StringVarP(&configFile, "config-file", "f", "config.yaml", "config file")
6367
}

cmd/devstream/verify.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ func verifyCMDFunc(cmd *cobra.Command, args []string) {
2222
log.Info("Verify finished.")
2323
}
2424
}
25+
26+
func init() {
27+
verifyCMD.Flags().StringVarP(&configFile, "config-file", "f", "config.yaml", "config file")
28+
verifyCMD.Flags().StringVarP(&pluginDir, "plugin-dir", "d", pluginengine.DefaultPluginDir, "plugins directory")
29+
}

0 commit comments

Comments
 (0)