Skip to content

Commit

Permalink
do not abuse color
Browse files Browse the repository at this point in the history
  • Loading branch information
xwjdsh committed Jan 5, 2022
1 parent b5e2528 commit e23a667
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
cmd/manssh/manssh
vendor
.idea
/manssh
7 changes: 1 addition & 6 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package manssh
import (
"fmt"

"github.com/fatih/color"

"github.com/xwjdsh/ssh_config"
)

Expand Down Expand Up @@ -48,27 +46,24 @@ func (hc *HostConfig) ConnectionStr() string {
user = hc.ImplicitConfig["user"]
delete(hc.ImplicitConfig, "user")
} else {
user = color.GreenString(user)
delete(hc.OwnConfig, "user")
}

if hostname, ok = hc.OwnConfig["hostname"]; !ok {
delete(hc.ImplicitConfig, "hostname")
hostname = hc.ImplicitConfig["hostname"]
} else {
hostname = color.GreenString(hostname)
delete(hc.OwnConfig, "hostname")
}

if port, ok = hc.OwnConfig["port"]; !ok {
port = hc.ImplicitConfig["port"]
delete(hc.ImplicitConfig, "port")
} else {
port = color.GreenString(port)
delete(hc.OwnConfig, "port")
}

return fmt.Sprintf("%s%s%s%s%s", user, color.GreenString("@"), hostname, color.GreenString(":"), port)
return fmt.Sprintf("%s@%s:%s", user, hostname, port)
}

// Display Whether to display connection string
Expand Down

0 comments on commit e23a667

Please # to comment.