]> 91.132.146.200 Git - scientia.git/commitdiff
some changes and maybe use cobra in the future
authorBanana <mail@bananas-playground.net>
Thu, 28 Mar 2024 14:44:56 +0000 (15:44 +0100)
committerBanana <mail@bananas-playground.net>
Thu, 28 Mar 2024 14:44:56 +0000 (15:44 +0100)
client/go-cli/Makefile
client/go-cli/README [deleted file]
client/go-cli/README.md [new file with mode: 0644]
client/go-cli/scientia-cli.go

index c1205f426cd5133a578daf5226ffe4f55db25bd8..b8ab31a020e67849838289d556bd040d3cc9f95b 100644 (file)
@@ -1,17 +1,28 @@
 all:
-       @echo "Options are: build and buildall"
+       @echo "Options are: build scientia-cli scientia-cli-linux-amd64 scientia-cli-windows-amd64 scientia-cli-darwin-amd64 clean buildall"
 
-build:
+scientia-cli:
        @echo "Building for local os/arch..."
-       go build -o scientia-cli-`go env GOOS`-`go env GOARCH`
+       go build -o scientia-cli
 
-buildall:
+scientia-cli-linux-amd64:
        @echo "Building for linux/amd64 arch..."
        GOOS=linux GOARCH=amd64 go build -o scientia-cli-linux-amd64
-       @echo "Done: scientia-cli-linux-amd64"
+
+scientia-cli-windows-amd64:
        @echo "Building for windows/amd64 arch..."
        GOOS=windows GOARCH=amd64 go build -o scientia-cli-windows-amd64
-       @echo "Done: scientia-cli-windows-amd64"
+
+scientia-cli-darwin-amd64:
        @echo "Building for macOS/amd64 arch..."
        GOOS=darwin GOARCH=amd64 go build -o scientia-cli-darwin-amd64
-       @echo "Done: scientia-cli-darwin-amd64"
\ No newline at end of file
+
+build:
+       @echo "Building for local os/arch..."
+       go build -o scientia-cli-`go env GOOS`-`go env GOARCH`
+
+buildall: scientia-cli-linux-amd64 scientia-cli-windows-amd64 scientia-cli-darwin-amd64
+       @echo "Building for linux/amd64, windows/amd64 and macOS/amd64 arch..."
+
+clean:
+       rm -f scientia-cli scientia-cli-darwin-amd64 scientia-cli-windows-amd64 scientia-cli-linux-amd64
\ No newline at end of file
diff --git a/client/go-cli/README b/client/go-cli/README
deleted file mode 100644 (file)
index a8b2fc3..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-This is a terminal cli client written in go to be used with scientia
-https://://www.bananas-playground.net/projekt/scientia
-
-!WARNING!
-This is a very simple, with limited experience written, go program.
-Use at own risk and feel free to improve.
-
-# Howto build
-Nothing special, just use the provide Makefile or directly "go build -o scientia-cli" to use your current os/arch settings.
-
-# Usage
-At first usage you need to create the config and the individual secret.
-Run $scientia-cli -create-config-file to create the default config file.
-The path to the config file is printed.
-Change the host address and update your server it with the secret, which is randomly created.
-
-Read from a file
-$ scientia-cli file.txt
-or piped
-$ cat file.txt | scientia-cli
-
-Commandline arguments (optional):
-  -create-config-file
-       Create default config file
-  -debug
-       Print debug infos
-  -verbose
-       Produce verbose output
diff --git a/client/go-cli/README.md b/client/go-cli/README.md
new file mode 100644 (file)
index 0000000..04ff93f
--- /dev/null
@@ -0,0 +1,32 @@
+# scienta go cli client
+
+This is a terminal cli client written in go to be used with scientia
+https://://www.bananas-playground.net/projekt/scientia/
+
+!WARNING!
+This is a very simple, with limited experience written, go program.
+Use at own risk and feel free to improve.
+
+# Howto build
+
+Nothing special, just use the provided Makefile or directly 
+"go build -o scientia-cli" to use your current os/arch settings.
+
+# Usage
+
+At first usage you need to create the config and the individual secret.
+Run $scientia-cli -create-config-file to create the default config file.
+The path to the config file is printed.
+Change the host address and update your server it with the secret, which is randomly created.
+
+## Create
+
+Read from a file `$ scientia-cli file.txt` or piped `$ cat file.txt | scientia-cli`
+
+# Commandline arguments
+
+## Optinal
+
++ `-create-config-file` Create default config file
++ `-debug` Print debug infos
++ `-verbose` Produce verbose output
index 837bd78930a1d52580907c18749ff9d406d0f674..cebde969bd21df0952d9f6714a87a1a78ff6340c 100644 (file)
@@ -6,12 +6,13 @@ import (
        "errors"
        "flag"
        "fmt"
-       "gopkg.in/yaml.v2"
        "io"
        "log"
        "math/rand"
        "net/http"
        "os"
+
+       "gopkg.in/yaml.v2"
 )
 
 /**
@@ -30,7 +31,7 @@ import (
  * along with this program.  If not, see http://www.sun.com/cddl/cddl.html
  */
 
-const website = "https://www.bananas-playground.net/projekt/scientia"
+const website = "https://www.bananas-playground.net/projekt/scientia/"
 const version = "1.0"
 
 // used for non-existing default config
@@ -69,6 +70,10 @@ type Response struct {
  */
 func main() {
 
+       // https://cli.urfave.org/v2/examples/arguments/
+       // https://github.com/dnote/dnote
+       //https://github.com/spf13/cobra/blob/main/site/content/user_guide.md
+
        // parse commandline parameters
        flag.BoolVar(&optsVerbose, "verbose", false, "Produce verbose output")
        flag.BoolVar(&optsCreateConfig, "create-config-file", false, "Create default config file")