Changeset 16 in code for trunk


Ignore:
Timestamp:
Apr 16, 2023, 2:15:45 AM (2 years ago)
Author:
yakumo.izuru
Message:

Add fallback value and just show translation output

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cmd/suwako/main.go

    r15 r16  
    1 // $TheSupernovaDuo: suwako,v 1.5.0 2023/03/25 10:41:00 akoizumi Exp
     1// $TheSupernovaDuo: suwako,v 1.5.1 2023/4/15 23:9:28 yakumo_izuru Exp $
    22// Command line client for SimplyTranslate, a privacy friendly frontend to other translation engines
    33package main
     
    3939
    4040        if len(engine) == 0 || len(instance) == 0 {
    41                 log.Fatal("SUWAKO_ENGINE and/or SUWAKO_INSTANCE are unset")
     41                log.Println("SUWAKO_ENGINE and/or SUWAKO_INSTANCE are unset")
     42                log.Println("Defaulting to translate.chaotic.ninja with engine 'google'")
     43                engine = "google"
     44                instance = "https://translate.chaotic.ninja"
    4245        }
    4346        if len(input) == 0 {
     
    5760        _ = json.NewDecoder(resp.Body).Decode(&translate)
    5861        sanityCheck(err)
    59         // Pretty-print both the input and the output given.
    60         fmt.Printf("Input: %v\n", input)
    61         fmt.Printf("Output: %v\n",translate.Output)
     62        fmt.Printf("%v\n",translate.Output)
    6263}
    6364func sanityCheck(err error) {
Note: See TracChangeset for help on using the changeset viewer.