aboutsummaryrefslogtreecommitdiffstats
path: root/bommom.go
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2012-04-18 23:12:11 -0400
committerbnewbold <bnewbold@robocracy.org>2012-04-18 23:12:11 -0400
commitb6a2d46c5bbdca7ca5d3e50eece732b5b839f2c5 (patch)
tree940c4c41d7585b715c29b7b3dd27e7ccb4e5d6d1 /bommom.go
parentb85e202511ea821c773f5eeb305ff71f040fc098 (diff)
downloadbommom-b6a2d46c5bbdca7ca5d3e50eece732b5b839f2c5.zip
bommom-b6a2d46c5bbdca7ca5d3e50eece732b5b839f2c5.tar.gz
bom load versioning
Diffstat (limited to 'bommom.go')
-rw-r--r--bommom.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/bommom.go b/bommom.go
index 42e0a1c..83f2610 100644
--- a/bommom.go
+++ b/bommom.go
@@ -247,7 +247,7 @@ func loadCmd() {
}
func convertCmd() {
- if flag.NArg() != 3 {
+ if flag.NArg() != 2 && flag.NArg() != 3 {
log.Fatal("Error: wrong number of arguments (expected input and output files)")
}
@@ -258,10 +258,21 @@ func convertCmd() {
outFname := flag.Arg(2)
bs, b := loadIn(inFname)
+
+ if b == nil {
+ log.Fatal("null bom")
+ }
if inFormat == "csv" && bs == nil {
// TODO: from inname? if ShortName?
bs = &BomStub{Name: "untitled", Owner: anonUser.name}
}
+
+ if err := bs.Validate(); err != nil {
+ log.Fatal("loaded bomstub not valid: " + err.Error())
+ }
+ if err := b.Validate(); err != nil {
+ log.Fatal("loaded bom not valid: " + err.Error())
+ }
dumpOut(outFname, bs, b)
}