mirror of
https://github.com/octoleo/restic.git
synced 2024-11-01 03:12:31 +00:00
Show currently used key in 'key list'
This commit is contained in:
parent
3b243ed1dd
commit
3e2c9dc267
@ -12,8 +12,8 @@ import (
|
|||||||
|
|
||||||
func list_keys(be backend.Server, key *khepri.Key) error {
|
func list_keys(be backend.Server, key *khepri.Key) error {
|
||||||
tab := NewTable()
|
tab := NewTable()
|
||||||
tab.Header = fmt.Sprintf("%-10s %-10s %-10s %s", "ID", "User", "Host", "Created")
|
tab.Header = fmt.Sprintf(" %-10s %-10s %-10s %s", "ID", "User", "Host", "Created")
|
||||||
tab.RowFormat = "%-10s %-10s %-10s %s"
|
tab.RowFormat = "%s%-10s %-10s %-10s %s"
|
||||||
|
|
||||||
plen, err := backend.PrefixLength(be, backend.Key)
|
plen, err := backend.PrefixLength(be, backend.Key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -27,7 +27,13 @@ func list_keys(be backend.Server, key *khepri.Key) error {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tab.Rows = append(tab.Rows, []interface{}{id[:plen],
|
var current string
|
||||||
|
if id.Equal(key.ID()) {
|
||||||
|
current = "*"
|
||||||
|
} else {
|
||||||
|
current = " "
|
||||||
|
}
|
||||||
|
tab.Rows = append(tab.Rows, []interface{}{current, id[:plen],
|
||||||
k.Username, k.Hostname, k.Created.Format(TimeFormat)})
|
k.Username, k.Hostname, k.Created.Format(TimeFormat)})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user