diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2022-04-05 11:31:50 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2022-04-05 11:31:50 +0200 |
commit | 75f55585aaeaa7bd9fcf2ec144ee8e890128a32a (patch) | |
tree | cf049b898b6fad321cdc057758a49d567135d837 /src/u_checks.go | |
parent | Man update (diff) | |
download | go2work-75f55585aaeaa7bd9fcf2ec144ee8e890128a32a.tar.gz go2work-75f55585aaeaa7bd9fcf2ec144ee8e890128a32a.tar.bz2 go2work-75f55585aaeaa7bd9fcf2ec144ee8e890128a32a.tar.xz go2work-75f55585aaeaa7bd9fcf2ec144ee8e890128a32a.tar.zst go2work-75f55585aaeaa7bd9fcf2ec144ee8e890128a32a.zip |
Added README.org
Diffstat (limited to '')
-rw-r--r-- | src/u_checks.go | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/u_checks.go b/src/u_checks.go index 9a12608..2a67211 100644 --- a/src/u_checks.go +++ b/src/u_checks.go @@ -39,7 +39,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * go2work: src/u_checks.go - * Fri Apr 1 18:30:55 CEST 2022 + * Tue Apr 5 11:13:23 CEST 2022 * Joe * * Useful checks. @@ -49,6 +49,7 @@ package main import ( "fmt" + "log" "os" "os/exec" ) @@ -63,7 +64,7 @@ func check_media_player(media_player string) bool { } func check_fortune() bool { - cmd := exec.Command("command", "-v", "fortune") + cmd := exec.Command("command", "-v", FORTUNE_BIN) err := cmd.Run() if err != nil { return false @@ -91,3 +92,17 @@ func check_file_exists(file string) bool { } return true } + +func first_checks(dest_t [3]byte, options Options) { + if check_time_format(dest_t) == false { + log.Fatal(LOG_FORMAT) + return + } + if check_media_player(options.Media_player) == false { + log.Fatal("media player (" + options.Media_player + ") not found") + return + } + if options.Fortune == true && check_fortune() == false { + print_fortune_not_found() + } +} |