fix grammar

This commit is contained in:
Celogeek 2024-03-03 10:25:29 +01:00
parent 06d690d493
commit a96b94f9d0
Signed by: celogeek
SSH Key Fingerprint: SHA256:njNJLzoLQdbV9PC6ehcruRb0QnEgxABoCYZ+0+aUIYc
2 changed files with 35 additions and 34 deletions

View File

@ -222,7 +222,7 @@ Retag the image you mark as "todo:todo-2006", 50 max at a time, by keeping the p
$ piwigo-cli images tag -x ^todo -T todo:todo-2006 -m 50 -K $ piwigo-cli images tag -x ^todo -T todo:todo-2006 -m 50 -K
``` ```
It display in well on iTerm: It displays in well on iTerm:
- image - image
- some details with the previous tag - some details with the previous tag

View File

@ -1,20 +1,21 @@
/* /*
Tree builder and viewer Tree builder and viewer
This allow you to create a tree of files and display them as a tree or flat view. This allows you to create a tree of files and display them as a tree or flat view.
Example Example
t := tree.New()
t.AddPath("a/b/c/d")
t.AddPath("a/b/e/f")
for v := range t.FlatView() { t := tree.New()
fmt.Println(v) t.AddPath("a/b/c/d")
} t.AddPath("a/b/e/f")
for v := range t.TreeView() { for v := range t.FlatView() {
fmt.Println(v) fmt.Println(v)
} }
for v := range t.TreeView() {
fmt.Println(v)
}
*/ */
package tree package tree
@ -32,7 +33,7 @@ type Tree interface {
} }
/* /*
Create a new tree Create a new tree
*/ */
func New() Tree { func New() Tree {
return &node{ return &node{
@ -46,18 +47,18 @@ type node struct {
} }
/* /*
Add a node to your tree and return it Add a node to your tree and return it
You can chain it: You can chain it:
t.Add("a").Add("b").Add("c").Add("d") t.Add("a").Add("b").Add("c").Add("d")
Or Or
c := t c := t
for _, s := range strings.Split("a/b/c/d", "/") { for _, s := range strings.Split("a/b/c/d", "/") {
c = c.Add(s) c = c.Add(s)
} }
*/ */
func (t *node) Add(name string) Tree { func (t *node) Add(name string) Tree {
if t.Nodes == nil { if t.Nodes == nil {
@ -72,9 +73,9 @@ func (t *node) Add(name string) Tree {
} }
/* /*
Add a path to your tree, separated with / Add a path to your tree, separated with /
t.AddPath("a/b/c/d") t.AddPath("a/b/c/d")
*/ */
func (t *node) AddPath(path string) Tree { func (t *node) AddPath(path string) Tree {
n := Tree(t) n := Tree(t)
@ -85,7 +86,7 @@ func (t *node) AddPath(path string) Tree {
} }
/* /*
Return a sorted list of children Return a sorted list of children
*/ */
func (t *node) Children() []*node { func (t *node) Children() []*node {
childs := make([]*node, len(t.Nodes)) childs := make([]*node, len(t.Nodes))
@ -101,18 +102,18 @@ func (t *node) Children() []*node {
} }
/* /*
Check if your node has a children Check if your node has a children
*/ */
func (t *node) HasChildren() bool { func (t *node) HasChildren() bool {
return t.Nodes != nil return t.Nodes != nil
} }
/* /*
Return a flat view of your tree Return a flat view of your tree
for v := range t.FlatView() { for v := range t.FlatView() {
fmt.Println(v) fmt.Println(v)
} }
*/ */
func (t *node) FlatView() (out chan string) { func (t *node) FlatView() (out chan string) {
out = make(chan string) out = make(chan string)
@ -137,11 +138,11 @@ func (t *node) FlatView() (out chan string) {
} }
/* /*
Return a tree view of your tree Return a tree view of your tree
for v := range t.TreeView() { for v := range t.TreeView() {
fmt.Println(v) fmt.Println(v)
} }
*/ */
func (t *node) TreeView() (out chan string) { func (t *node) TreeView() (out chan string) {
out = make(chan string) out = make(chan string)