Simple pre-flight checks

More of this to come ...
This commit is contained in:
Stephen McQuay 2018-02-26 20:02:23 -08:00
parent 2ec42dd61c
commit 85e33bbe90
Signed by untrusted user: sm
GPG Key ID: 4E4B72F479BA3CE5
1 changed files with 11 additions and 1 deletions

View File

@ -1,8 +1,18 @@
package pkg
import "fmt"
import (
"fmt"
"mcquay.me/fs"
)
// Create traverses the contents of dir and emits a valid pkg, signed by id
func Create(dir, id string) error {
if !fs.Exists(dir) {
return fmt.Errorf("%q: doesn't exist", dir)
}
if !fs.IsDir(dir) {
return fmt.Errorf("%q: is not a directory", dir)
}
return fmt.Errorf("creating package from %q for %q: NYI", dir, id)
}