Skip to content

Commit 9d8fd8f

Browse files
author
Matthew Fisher
committed
style(cmd): add deis logo to start and install commands
1 parent 938f4eb commit 9d8fd8f

3 files changed

Lines changed: 27 additions & 21 deletions

File tree

cmd/cmd.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ func Start(b backend.Backend, targets []string) error {
6464
}
6565

6666
func StartPlatform(b backend.Backend) error {
67-
fmt.Println("Starting Platform...")
67+
fmt.Println(utils.DeisIfy("Starting Deis..."))
6868
if err := startDataContainers(b); err != nil {
6969
return err
7070
}
7171
if err := startDefaultServices(b); err != nil {
7272
return err
7373
}
74-
fmt.Println("Platform started.")
74+
fmt.Println("Deis started.")
7575
return nil
7676
}
7777

@@ -105,11 +105,11 @@ func Stop(b backend.Backend, targets []string) error {
105105
}
106106

107107
func StopPlatform(b backend.Backend) error {
108-
fmt.Println("Stopping Platform...")
108+
fmt.Println("Stopping Deis...")
109109
if err := stopDefaultServices(b); err != nil {
110110
return err
111111
}
112-
fmt.Println("Platform stopped.")
112+
fmt.Println("Deis stopped.")
113113
return nil
114114
}
115115

@@ -164,16 +164,16 @@ func Install(b backend.Backend, targets []string) error {
164164
}
165165

166166
func InstallPlatform(b backend.Backend) error {
167-
fmt.Println("Installing Platform...")
167+
fmt.Println(utils.DeisIfy("Installing Deis..."))
168168
if err := installDataContainers(b); err != nil {
169169
return err
170170
}
171-
if err := installDefaultServices(b); err != nil {
172-
return err
173-
}
174-
fmt.Println("Platform installed.")
175-
fmt.Println("Please run `deisctl start platorm` to boot up the platform.")
176-
return nil
171+
if err := installDefaultServices(b); err != nil {
172+
return err
173+
}
174+
fmt.Println("Deis installed.")
175+
fmt.Println("Please run `deisctl start platform` to boot up Deis.")
176+
return nil
177177
}
178178

179179
func installDataContainers(b backend.Backend) error {

deisctl.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"github.com/deis/deisctl/backend/fleet"
99
"github.com/deis/deisctl/client"
10+
"github.com/deis/deisctl/utils"
1011

1112
docopt "github.com/docopt/docopt-go"
1213
)
@@ -41,16 +42,7 @@ func setGlobalFlags(args map[string]interface{}) {
4142
}
4243

4344
func main() {
44-
circle := "\033[31m●"
45-
square := "\033[32m■"
46-
triangle := "\033[34m▴"
47-
reset := "\033[0m"
48-
title := reset + "Deis Control Utility"
49-
50-
deisctlMotd := fmt.Sprintf("%s %s %s\n%s %s %s %s\n%s %s %s%s\n",
51-
circle, triangle, square,
52-
square, circle, triangle, title,
53-
triangle, square, circle, reset)
45+
deisctlMotd := utils.DeisIfy("Deis Control Utility")
5446
usage := deisctlMotd + `
5547
Usage:
5648
deisctl <command> [<target>...] [options]

utils/utils.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,17 @@ func ExpandUser(path string) (string, error) {
266266
}
267267
return strings.Replace(path, "~/", user.HomeDir+"/", 1), nil
268268
}
269+
270+
// DeisIfy returns a pretty-printed deis logo along with the corresponding message
271+
func DeisIfy(message string) string {
272+
circle := "\033[31m●"
273+
square := "\033[32m■"
274+
triangle := "\033[34m▴"
275+
reset := "\033[0m"
276+
title := reset + message
277+
278+
return fmt.Sprintf("%s %s %s\n%s %s %s %s\n%s %s %s%s\n",
279+
circle, triangle, square,
280+
square, circle, triangle, title,
281+
triangle, square, circle, reset)
282+
}

0 commit comments

Comments
 (0)