Cleaning up more error handling

main
Nick Dumas 2 years ago
parent 6be36326bb
commit 9bf9e2f2ef

@ -26,10 +26,6 @@ var validateCmd = &cobra.Command{
// Uncomment the following line if your bare application // Uncomment the following line if your bare application
// has an action associated with it: // has an action associated with it:
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
schemaURL := cmd.Flag("schema").Value.String()
if len(schemaURL) == 0 {
return fmt.Errorf("Please profide a schema filename")
}
target := cmd.Flag("target").Value.String() target := cmd.Flag("target").Value.String()
if len(target) == 0 { if len(target) == 0 {
return fmt.Errorf("Please profide a target filename") return fmt.Errorf("Please profide a target filename")
@ -37,7 +33,7 @@ var validateCmd = &cobra.Command{
root := os.DirFS(target) root := os.DirFS(target)
_, err := root.Open(".") _, err := root.Open(".")
if err != nil { if err != nil {
return fmt.Errorf("cannot open target directory %q: %w", target, err) return fmt.Errorf("cannot open provided vault root %q: %w", target, err)
} }
return nil return nil
}, },

Loading…
Cancel
Save