Skip to content
Snippets Groups Projects
Commit 74d33721 authored by Tamer Tas's avatar Tamer Tas
Browse files

Add os exit utilities

parent 88cc8316
No related branches found
No related tags found
No related merge requests found
package exit
import (
"fmt"
"os"
"github.com/tmrts/tmplt/pkg/util/tlog"
)
const (
CodeOK = 0
CodeError = 2
)
func Error(err error) {
tlog.Error(fmt.Sprint(err))
os.Exit(CodeError)
}
func OK(msg string) {
os.Exit(CodeOK)
}
......@@ -10,3 +10,12 @@ func FileExists(filename string) error {
return nil
}
func DirExists(dirname string) error {
_, err := os.Stat(dirname)
if err != nil {
return err
}
return nil
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment