Skip to content

Commit

Permalink
fix: windows fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
beneiltis committed Oct 18, 2023
1 parent 894aec3 commit 834e045
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 15 deletions.
1 change: 1 addition & 0 deletions cmd/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var localCmd = &cobra.Command{
Long: `Run punq from your local machine in your current-context in kubernetes.`,
Run: func(cmd *cobra.Command, args []string) {
utils.PrintLogo()
fmt.Println("")
utils.PrintSettings()

contexts := services.ListContexts()
Expand Down
1 change: 1 addition & 0 deletions cmd/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var operatorCmd = &cobra.Command{
Long: `Run the operator inside the cluster!`,
Run: func(cmd *cobra.Command, args []string) {
utils.PrintLogo()
fmt.Println("")
println("\n###############################################")
utils.IsNewReleaseAvailable()
println("###############################################\n")
Expand Down
3 changes: 3 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var cmdsWithoutContext = []string{
"punq system ingress-controller-type",
"punq install",
"punq clean",
"punq version",
}

var rootCmd = &cobra.Command{
Expand Down Expand Up @@ -62,6 +63,8 @@ var rootCmd = &cobra.Command{
}
},
Run: func(cmd *cobra.Command, args []string) {
utils.PrintLogo()
fmt.Println("")
utils.PrintWelcomeMessage()
},
}
Expand Down
1 change: 1 addition & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func init() {

func PrintVersion() {
utils.PrintLogo()
fmt.Println("")
yellow := color.New(color.FgYellow).SprintFunc()
fmt.Printf(" CLI: %s\n", yellow(version.Ver))
fmt.Printf(" OperatorImage: %s\n", yellow(version.OperatorImage))
Expand Down
7 changes: 6 additions & 1 deletion utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/charmbracelet/glamour"
Expand Down Expand Up @@ -180,7 +181,11 @@ func PrintWelcomeMessage() {
}

func getTermialSize() int {
width, _, err := term.GetSize(0)
fd := 0
if runtime.GOOS == "windows" {
fd = int(os.Stdout.Fd())
}
width, _, err := term.GetSize(fd)
if err != nil {
logger.Log.Errorf("Failed getting terminal size: %v", err)
}
Expand Down
22 changes: 10 additions & 12 deletions utils/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,17 +231,15 @@ func HumanDuration(d time.Duration) string {
}

func PrintLogo() {
logo := ` ______ __ __ _______ ______
/ \| \ | \ \ / \
| ▓▓▓▓▓▓\ ▓▓ | ▓▓ ▓▓▓▓▓▓▓\ ▓▓▓▓▓▓\
| ▓▓ | ▓▓ ▓▓ | ▓▓ ▓▓ | ▓▓ ▓▓ | ▓▓
| ▓▓__/ ▓▓ ▓▓__/ ▓▓ ▓▓ | ▓▓ ▓▓__| ▓▓
| ▓▓ ▓▓\▓▓ ▓▓ ▓▓ | ▓▓\▓▓ ▓▓
| ▓▓▓▓▓▓▓ \▓▓▓▓▓▓ \▓▓ \▓▓ \▓▓▓▓▓▓▓
| ▓▓ | ▓▓
| ▓▓ | ▓▓
\▓▓ \▓▓`
fmt.Println("")
logo := ` ______ __ __ _______ ______
/ \| \ | \ \ / \
| ▓▓▓▓▓▓\ ▓▓ | ▓▓ ▓▓▓▓▓▓▓\ ▓▓▓▓▓▓\
| ▓▓ | ▓▓ ▓▓ | ▓▓ ▓▓ | ▓▓ ▓▓ | ▓▓
| ▓▓__/ ▓▓ ▓▓__/ ▓▓ ▓▓ | ▓▓ ▓▓__| ▓▓
| ▓▓ ▓▓\▓▓ ▓▓ ▓▓ | ▓▓\▓▓ ▓▓
| ▓▓▓▓▓▓▓ \▓▓▓▓▓▓ \▓▓ \▓▓ \▓▓▓▓▓▓▓
| ▓▓ | ▓▓
| ▓▓ | ▓▓
\▓▓ \▓▓`
fmt.Print(logo)
fmt.Println("")
}
6 changes: 4 additions & 2 deletions welcome.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Install punq on your cluster in your current context. This will also set up the ingress to deliver punq on your own domain. You'll be asked to confirm with "Y".
punq install -i punq.yourdomain.com

- In your domain's DNS settings, add a record for the punq domain, e.g. punq.yourdomain.com.
- In your domain's DNS settings, add an A-Record for the punq domain which points to your cluster loadbalancer IP, e.g. A: 123.123.123.123 -> punq.yourdomain.com.
- Open punq in your browser.
- Log in with the admin credentials. They are prompted to your terminal once punq is installed. Make sure to store the admin credentials in a safe place, they will only be displayed once after installation.
- The cluster where punq was installed is set up per default in your punq instance. To add more clusters, use the dropdown in the top left corner and follow the instructions. Upload your kubeconfig to add more clusters.
- The cluster where punq was installed is set up per default in your punq instance. To add more clusters, use the dropdown in the top left corner and follow the instructions. Upload your kubeconfig to add more clusters.

For more commands type --help.

**🤘 You're ready to go, have fun with punq 🤘**

0 comments on commit 834e045

Please sign in to comment.