github.com/spg/deis@v1.7.3/deisctl/utils/utils.go (about)

     1  // Package utils contains commonly useful functions from Deisctl
     2  package utils
     3  
     4  import (
     5  	"fmt"
     6  	"os"
     7  	"strings"
     8  )
     9  
    10  // DeisIfy returns a pretty-printed deis logo along with the corresponding message
    11  func DeisIfy(message string) string {
    12  	circle := "\033[31m●"
    13  	square := "\033[32m■"
    14  	triangle := "\033[34m▴"
    15  	reset := "\033[0m"
    16  	title := reset + message
    17  
    18  	return fmt.Sprintf("%s %s %s\n%s %s %s %s\n%s %s %s%s\n",
    19  		circle, triangle, square,
    20  		square, circle, triangle, title,
    21  		triangle, square, circle, reset)
    22  }
    23  
    24  // ResolvePath returns the path with a tilde (~) and $HOME replaced by the actual home directory
    25  func ResolvePath(path string) string {
    26  	path = strings.Replace(path, "~", os.Getenv("HOME"), -1)
    27  	// Using $HOME seems to work just fine with `deisctl config`, but not `deisctl refresh-units`
    28  	path = strings.Replace(path, "$HOME", os.Getenv("HOME"), -1)
    29  	return path
    30  }