Merge branch 'master' of github.com:wyst-lang/wyst-package-manager
This commit is contained in:
+4
-2
@@ -48,13 +48,15 @@ func createPackage(packageName string) {
|
|||||||
jsonBody := []byte(fmt.Sprintf(`{"name": "%v", "psw": "%v", "repo": "%v", "latest": "%v"}`, packageName, psw, repo, version))
|
jsonBody := []byte(fmt.Sprintf(`{"name": "%v", "psw": "%v", "repo": "%v", "latest": "%v"}`, packageName, psw, repo, version))
|
||||||
_, err := sendRequest(http.MethodPost, URL, jsonBody)
|
_, err := sendRequest(http.MethodPost, URL, jsonBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func editPackage(packageName string) {
|
func editPackage(packageName string) {
|
||||||
pkgidx, err := getPackage(packageName)
|
pkgidx, err := getPackage(packageName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
var psw string
|
var psw string
|
||||||
var repo string = pkgidx.Repo
|
var repo string = pkgidx.Repo
|
||||||
@@ -67,7 +69,7 @@ func editPackage(packageName string) {
|
|||||||
newPsw = psw
|
newPsw = psw
|
||||||
|
|
||||||
for true {
|
for true {
|
||||||
fmt.Printf("\033[2J")
|
clear()
|
||||||
fmt.Println("Choose what you want to modify")
|
fmt.Println("Choose what you want to modify")
|
||||||
fmt.Printf(" 1 -> package name: %s\n", newPackageName)
|
fmt.Printf(" 1 -> package name: %s\n", newPackageName)
|
||||||
fmt.Printf(" 2 -> password: %s\n", newPsw)
|
fmt.Printf(" 2 -> password: %s\n", newPsw)
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
@@ -76,3 +78,16 @@ func ReadPassword(buff *string) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func clear() {
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "windows":
|
||||||
|
cmd := exec.Command("cmd", "/c", "cls")
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Run()
|
||||||
|
default: // Unix-like systems
|
||||||
|
cmd := exec.Command("clear")
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Run()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user