Hide open shortcut in statusbar if no open command found

pull/38/head
Miguel Mota 5 years ago
parent 52496b87fb
commit f1da2dcb40
No known key found for this signature in database
GPG Key ID: 67EC1161588A00F9

@ -41,3 +41,8 @@ func URL(s string) error {
}
return nil
}
// CommandExists returns true if an 'open' command exists
func CommandExists() bool {
return openCmd != ""
}

@ -3,6 +3,7 @@ package cointop
import (
"fmt"
"github.com/miguelmota/cointop/cointop/common/open"
"github.com/miguelmota/cointop/cointop/common/pad"
)
@ -44,7 +45,14 @@ func (ct *Cointop) updateStatusbar(s string) error {
return nil
}
func (ct *Cointop) refreshRowLink() {
func (ct *Cointop) refreshRowLink() error {
var shortcut string
if !open.CommandExists() {
shortcut = "[O]Open "
}
url := ct.rowLinkShort()
ct.updateStatusbar(fmt.Sprintf("%sOpen %s", "[O]", url))
ct.updateStatusbar(fmt.Sprintf("%s%s", shortcut, url))
return nil
}

Loading…
Cancel
Save