diff --git a/cmd/lume/main.go b/cmd/lume/main.go index f22f9d9..4f21b8b 100644 --- a/cmd/lume/main.go +++ b/cmd/lume/main.go @@ -1,16 +1,11 @@ package main import ( - "fmt" "os" lumecmd "git.kill0.net/chill9/lume/cmd" ) func main() { - exitCode, err := lumecmd.Main(os.Args) - if err != nil { - fmt.Fprintf(os.Stderr, "%s\n", err) - } - os.Exit(exitCode) -} + lumecmd.ExitWithCode(lumecmd.Main(os.Args)) +} \ No newline at end of file diff --git a/cmd/util.go b/cmd/util.go index ebba208..445eadf 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -2,6 +2,7 @@ package lumecmd import ( "fmt" + "os" "sort" "strconv" "strings" @@ -151,3 +152,10 @@ func sortResults(res []lifx.Result) { return res[i].Label < res[j].Label }) } + +func ExitWithCode(code int, err error) { + if err != nil { + fmt.Fprintf(os.Stderr, "%s\n", err) + } + os.Exit(code) +}