From ac0db74f9bac72fe811f89dc9c2cf92e5e8bac22 Mon Sep 17 00:00:00 2001 From: "yakumo.izuru" Date: Sun, 16 Apr 2023 02:15:45 +0000 Subject: [PATCH] Add fallback value and just show translation output Signed-off-by: Izuru Yakumo git-svn-id: file:///srv/svn/repo/suwako/trunk@16 0b558ee1-521d-8b46-a41b-40029c97c055 --- cmd/suwako/main.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/suwako/main.go b/cmd/suwako/main.go index 4151d20..551e943 100644 --- a/cmd/suwako/main.go +++ b/cmd/suwako/main.go @@ -1,4 +1,4 @@ -// $TheSupernovaDuo: suwako,v 1.5.0 2023/03/25 10:41:00 akoizumi Exp +// $TheSupernovaDuo: suwako,v 1.5.1 2023/4/15 23:9:28 yakumo_izuru Exp $ // Command line client for SimplyTranslate, a privacy friendly frontend to other translation engines package main @@ -38,7 +38,10 @@ func main() { flag.Parse() if len(engine) == 0 || len(instance) == 0 { - log.Fatal("SUWAKO_ENGINE and/or SUWAKO_INSTANCE are unset") + log.Println("SUWAKO_ENGINE and/or SUWAKO_INSTANCE are unset") + log.Println("Defaulting to translate.chaotic.ninja with engine 'google'") + engine = "google" + instance = "https://translate.chaotic.ninja" } if len(input) == 0 { log.Fatal("Missing input text.") @@ -56,9 +59,7 @@ func main() { // JSON decoding _ = json.NewDecoder(resp.Body).Decode(&translate) sanityCheck(err) - // Pretty-print both the input and the output given. - fmt.Printf("Input: %v\n", input) - fmt.Printf("Output: %v\n",translate.Output) + fmt.Printf("%v\n",translate.Output) } func sanityCheck(err error) { if err != nil {