From: Simon Ruderich Date: Sat, 8 Jun 2019 12:33:58 +0000 (+0200) Subject: nsscash: add support to convert plain files X-Git-Tag: 0.1~89 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=0f368ece4ec73bc058d5fb1459221ffd860d3bf3;p=nsscash%2Fnsscash.git nsscash: add support to convert plain files For plain files this is just a copy. But it prepares for conversion of other types in the future. --- diff --git a/main.go b/main.go index cef6c61..db21997 100644 --- a/main.go +++ b/main.go @@ -82,15 +82,21 @@ func main() { if err != nil { log.Fatal(err) } + var x bytes.Buffer + if t == FileTypePlain { + x.Write(src) + } else if t == FileTypePasswd { pws, err := ParsePasswds(bytes.NewReader(src)) if err != nil { log.Fatal(err) } - var x bytes.Buffer err = SerializePasswds(&x, pws) if err != nil { log.Fatal(err) } + } else { + log.Fatalf("unsupported file type %v", t) + } // We must create the file first or deployFile() will abort f, err := os.Create(args[3])