Make queues list output consistent with git status

This commit is contained in:
rubyist 2014-05-28 14:35:58 -04:00 committed by Rick Olson
parent 2d5a920bb5
commit 3425ae831d

@ -3,6 +3,8 @@ package gitmedia
import ( import (
".." ".."
"../queuedir" "../queuedir"
"os"
"path/filepath"
"strings" "strings"
) )
@ -12,11 +14,14 @@ type QueuesCommand struct {
func (c *QueuesCommand) Run() { func (c *QueuesCommand) Run() {
err := gitmedia.WalkQueues(func(name string, queue *queuedir.Queue) error { err := gitmedia.WalkQueues(func(name string, queue *queuedir.Queue) error {
wd, _ := os.Getwd()
gitmedia.Print(name) gitmedia.Print(name)
return queue.Walk(func(id string, body []byte) error { return queue.Walk(func(id string, body []byte) error {
parts := strings.Split(string(body), ":") parts := strings.Split(string(body), ":")
if len(parts) == 2 { if len(parts) == 2 {
gitmedia.Print(" " + parts[1]) absPath := filepath.Join(gitmedia.LocalWorkingDir, parts[1])
relPath, _ := filepath.Rel(wd, absPath)
gitmedia.Print(" " + relPath)
} else { } else {
gitmedia.Print(" " + parts[0]) gitmedia.Print(" " + parts[0])
} }