Skip to content

Commit ee97e68

Browse files
author
Gabriel Monroy
committed
Merge pull request #63 from bacongobbler/deisctl-pretty-print
feat(client): pretty-print deisctl
2 parents 5363a94 + 9d8fd8f commit ee97e68

3 files changed

Lines changed: 28 additions & 7 deletions

File tree

cmd/cmd.go

Lines changed: 11 additions & 5 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,10 +164,16 @@ func Install(b backend.Backend, targets []string) error {
164164
}
165165

166166
func InstallPlatform(b backend.Backend) error {
167+
fmt.Println(utils.DeisIfy("Installing Deis..."))
167168
if err := installDataContainers(b); err != nil {
168169
return err
169170
}
170-
return installDefaultServices(b)
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
171177
}
172178

173179
func installDataContainers(b backend.Backend) error {

deisctl.go

Lines changed: 3 additions & 2 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,8 +42,8 @@ func setGlobalFlags(args map[string]interface{}) {
4142
}
4243

4344
func main() {
44-
usage := `Deis Control Utility
45-
45+
deisctlMotd := utils.DeisIfy("Deis Control Utility")
46+
usage := deisctlMotd + `
4647
Usage:
4748
deisctl <command> [<target>...] [options]
4849

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)