本文整理汇总了Golang中tmsu/storage.Storage.Implications方法的典型用法代码示例。如果您正苦于以下问题:Golang Storage.Implications方法的具体用法?Golang Storage.Implications怎么用?Golang Storage.Implications使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tmsu/storage.Storage
的用法示例。
在下文中一共展示了Storage.Implications方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: listImplications
func (command ImplyCommand) listImplications(store *storage.Storage) error {
if command.verbose {
log.Infof("retrieving tag implications.")
}
implications, err := store.Implications()
if err != nil {
return fmt.Errorf("could not retrieve implications: %v", err)
}
width := 0
for _, implication := range implications {
length := len(implication.ImplyingTag.Name)
if length > width {
width = length
}
}
previousImplyingTagName := ""
for _, implication := range implications {
if implication.ImplyingTag.Name != previousImplyingTagName {
if previousImplyingTagName != "" {
fmt.Println()
}
previousImplyingTagName = implication.ImplyingTag.Name
fmt.Printf("%*v -> %v", width, implication.ImplyingTag.Name, implication.ImpliedTag.Name)
} else {
fmt.Printf(", %v", implication.ImpliedTag.Name)
}
}
fmt.Println()
return nil
}