chore: esthetics + update changelog

This commit is contained in:
Manfred Touron 2018-03-14 18:17:40 +01:00
parent 09ac2c35f3
commit 6f2b58cbdc
2 changed files with 11 additions and 12 deletions

View file

@ -7,6 +7,7 @@
* Add TTY audit feature ([#23](https://github.com/moul/sshportal/issues/23)) by [@sabban](https://github.com/sabban) * Add TTY audit feature ([#23](https://github.com/moul/sshportal/issues/23)) by [@sabban](https://github.com/sabban)
* Fix `--assign-*` commands when using MySQL driver ([#45](https://github.com/moul/sshportal/issues/45)) * Fix `--assign-*` commands when using MySQL driver ([#45](https://github.com/moul/sshportal/issues/45))
* Add *HOP* support, an efficient and integrated way of using a jump host transparently ([#47](https://github.com/moul/sshportal/issues/47)) by [@mathieui](https://github.com/mathieui) * Add *HOP* support, an efficient and integrated way of using a jump host transparently ([#47](https://github.com/moul/sshportal/issues/47)) by [@mathieui](https://github.com/mathieui)
* Fix panic on some `ls` commands ([#54](https://github.com/moul/sshportal/pull/54)) by [@jle64](https://github.com/jle64)
## v1.7.1 (2018-01-03) ## v1.7.1 (2018-01-03)

View file

@ -32,6 +32,10 @@ var banner = `
` `
var startTime = time.Now() var startTime = time.Now()
const (
naMessage = "n/a"
)
func shell(s ssh.Session) error { func shell(s ssh.Session) error {
var ( var (
sshCommand = s.Command() sshCommand = s.Command()
@ -1862,11 +1866,9 @@ GLOBAL OPTIONS:
table.SetBorder(false) table.SetBorder(false)
table.SetCaption(true, fmt.Sprintf("Total: %d userkeys.", len(userKeys))) table.SetCaption(true, fmt.Sprintf("Total: %d userkeys.", len(userKeys)))
for _, userkey := range userKeys { for _, userkey := range userKeys {
var email string email := naMessage
if userkey.User != nil { if userkey.User != nil {
email = userkey.User.Email email = userkey.User.Email
} else {
email = "n/a"
} }
table.Append([]string{ table.Append([]string{
fmt.Sprintf("%d", userkey.ID), fmt.Sprintf("%d", userkey.ID),
@ -1967,17 +1969,13 @@ GLOBAL OPTIONS:
duration = humanize.RelTime(session.CreatedAt, *session.StoppedAt, "", "") duration = humanize.RelTime(session.CreatedAt, *session.StoppedAt, "", "")
} }
duration = strings.Replace(duration, "now", "1 second", 1) duration = strings.Replace(duration, "now", "1 second", 1)
var hostname string hostname := naMessage
if session.Host != nil { if session.Host != nil {
hostname = session.Host.Name hostname = session.Host.Name
} else {
hostname = "n/a"
} }
var username string username := naMessage
if session.User != nil { if session.User != nil {
username = session.User.Name username = session.User.Name
} else {
username = "n/a"
} }
table.Append([]string{ table.Append([]string{
fmt.Sprintf("%d", session.ID), fmt.Sprintf("%d", session.ID),