From 860fe777446d0aab7a957fc95b76f9d6ee67dc5a Mon Sep 17 00:00:00 2001 From: "koizumi.aoi" Date: Sat, 11 Feb 2023 11:04:52 +0000 Subject: [PATCH] doc: target language is no longer required, put usage notes on readme. git-svn-id: file:///srv/svn/repo/suwako/trunk@9 0b558ee1-521d-8b46-a41b-40029c97c055 --- README | 14 ++++++++++++++ main.go | 7 ++++--- stcli.1 | 4 ++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/README b/README index 09f7713..05c8bbb 100644 --- a/README +++ b/README @@ -1,3 +1,17 @@ stcli ===== Command-line client for SimplyTranslate in Go. + +Usage +----- +-I string + Enter the text to be translated +-e string + Translation engine to use (default: google) (default "google") +-f string + Set the language to translate from. This can be skipped as it will autodetect the language you're translating from (default "auto") +-i string + Instance to use (default: https://simplytranslate.org/api/translate/) (default "https://simplytranslate.org/api/translate/") +-t string + Set the language to translate to (default: en) (default "en") + diff --git a/main.go b/main.go index dfb771c..5fb1780 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -// $KyokoNet: stcli,v 1.3 2022/12/13 23:57:00 akoizumi Exp +// $TheSupernovaDuo: stcli,v 1.3.1 2023/02/11 07:54:25 akoizumi Exp // Command line client for SimplyTranslate, a privacy friendly frontend to other translation engines package main @@ -32,8 +32,8 @@ func main() { flag.Parse() // Check if any of those two variables is empty. // It actually needs the two to have content. - if len(input) == 0 || len(to) == 0 { - log.Fatal("Missing either the text or the target language.") + if len(input) == 0 { + log.Fatal("Missing input.") } // Map a variable to the struct var translate Translate @@ -44,6 +44,7 @@ func main() { resp, err := http.Get(queryURL) sanityCheck(err) defer resp.Body.Close() + // JSON decoding _ = json.NewDecoder(resp.Body).Decode(&translate) sanityCheck(err) // Pretty-print both the input and the output given. diff --git a/stcli.1 b/stcli.1 index 058e9bb..08f55fd 100644 --- a/stcli.1 +++ b/stcli.1 @@ -1,4 +1,4 @@ -.Dd Aftermath 57, 3188 +.Dd Chaos 42, 3189 .Dt STCLI 1 .Os .Sh NAME @@ -30,7 +30,7 @@ Text to translate Target language to translate to .El .Sh AUTHORS -.An Aoi K. Aq Mt koizumi.aoi@kyoko-project.wer.ee +.An Aoi K. Aq Mt koizumi.aoi@chaotic.ninja .Pp .An Czar of KST Aq Mt czar@kalli.st .Pp