1
0
Fork 0
mirror of https://github.com/diamondburned/cchat-gtk.git synced 2024-12-25 05:27:23 +00:00
cchat-gtk/internal/ui/service/breadcrumb/breadcrumb.go

22 lines
408 B
Go
Raw Normal View History

2020-06-06 00:47:28 +00:00
package breadcrumb
import "strings"
type Breadcrumb []string
func (b Breadcrumb) String() string {
return strings.Join([]string(b), "/")
}
type Breadcrumber interface {
Breadcrumb() Breadcrumb
}
// Try accepts a nilable breadcrumber and handles it appropriately.
func Try(i Breadcrumber, appended ...string) []string {
if i == nil {
return appended
}
return append(i.Breadcrumb(), appended...)
}