Simplify verbose output for now

pull/103/head
Mickaël Menu 3 years ago
parent 3711a4f746
commit da862bf60a

@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
note-detail = "{{filename-stem}}"
```
* New `--dry-run` flag for `zk new` which prints out the path and content of the generated note instead of saving it to the file system.
* New `--verbose` flag for `zk index` which prints detailed information about the indexing process.
### Fixed

@ -98,7 +98,7 @@ func (t *indexTask) execute(callback func(change paths.DiffChange)) (NoteIndexin
print := func(message string) {
if t.verbose {
fmt.Print(message + "\n")
fmt.Println(message)
}
}
@ -155,26 +155,11 @@ func (t *indexTask) execute(callback func(change paths.DiffChange)) (NoteIndexin
print("- " + change.Kind.String() + " " + change.Path)
absPath := filepath.Join(t.path, change.Path)
printNote := func(note *Note) {
print(" title: " + note.Title)
if len(note.Links) > 0 {
print(" links: [")
for _, link := range note.Links {
print(" title: \"" + link.Title + "\", href: \"" + link.Href + "\"")
}
print(" ]")
} else {
print(" links: []")
}
}
switch change.Kind {
case paths.DiffAdded:
stats.AddedCount += 1
note, err := t.parser.ParseNoteAt(absPath)
if note != nil {
printNote(note)
_, err = t.index.Add(*note)
}
t.logger.Err(err)
@ -183,7 +168,6 @@ func (t *indexTask) execute(callback func(change paths.DiffChange)) (NoteIndexin
stats.ModifiedCount += 1
note, err := t.parser.ParseNoteAt(absPath)
if note != nil {
printNote(note)
err = t.index.Update(*note)
}
t.logger.Err(err)
@ -194,12 +178,11 @@ func (t *indexTask) execute(callback func(change paths.DiffChange)) (NoteIndexin
t.logger.Err(err)
}
print("")
return nil
})
for _, ignored := range ignoredFiles {
print("- ignored " + ignored.Path + "\n " + ignored.Reason + "\n")
print("- ignored " + ignored.Path + ": " + ignored.Reason)
}
stats.SourceCount = count

Loading…
Cancel
Save