Adds pm rm

This commit is contained in:
sm
2018-03-06 21:46:25 -08:00
parent f07b5a7d0e
commit 51c8c920a3
3 changed files with 72 additions and 3 deletions
+22
View File
@@ -0,0 +1,22 @@
package pm
import (
"bufio"
"fmt"
"io"
"strings"
)
// ParseCS returns a parsed checksum file.
func ParseCS(f io.Reader) (map[string]string, error) {
cs := map[string]string{}
s := bufio.NewScanner(f)
for s.Scan() {
elems := strings.Split(s.Text(), "\t")
if len(elems) != 2 {
return nil, fmt.Errorf("manifest format error; got %d elements, want 2", len(elems))
}
cs[elems[1]] = elems[0]
}
return cs, nil
}