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
This commit is contained in:
koizumi.aoi 2023-02-11 11:04:52 +00:00
parent 1d2d7d2020
commit 860fe77744
3 changed files with 20 additions and 5 deletions

14
README
View File

@ -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")

View File

@ -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.

View File

@ -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