From d52fd7d745952e57e9b6b8fa0191f097a2647643 Mon Sep 17 00:00:00 2001 From: sinalalebakhsh Date: Mon, 9 Oct 2023 15:26:13 -0400 Subject: [PATCH] ++ --- GetUserInput/GetUserInput.go | 14 +++++ README.md | 4 ++ features/CreatingHTTPClients.go | 8 +++ features/Printer.go | 23 +++++++- features/helpMessage.go | 99 +++++++++++++++++++++------------ 5 files changed, 111 insertions(+), 37 deletions(-) create mode 100644 features/CreatingHTTPClients.go diff --git a/GetUserInput/GetUserInput.go b/GetUserInput/GetUserInput.go index b22d8e7..f5fd200 100644 --- a/GetUserInput/GetUserInput.go +++ b/GetUserInput/GetUserInput.go @@ -42,6 +42,11 @@ func GetUserInput() { Regular = IfUserisHELP(FinalInput) // If FinalInput is or does't "help" return true } + if Regular { + Regular = IfUserisCLEAR(FinalInput) + } + + if Regular { if FirstCount { Regular = GetUserForBrowser(FinalInput) @@ -75,6 +80,7 @@ func IfUsrisEXIT(FinalInput string) bool { Exit := "exit" if FinalInput == strings.ToLower(Exit) { features.GoodByePrint() + features.ClearTerminal() os.Exit(0) } return true @@ -89,6 +95,14 @@ func IfUserisHELP(FinalInput string) bool { return true } +func IfUserisCLEAR(FinalInput string) bool { + if FinalInput == strings.ToLower("clear") { + features.ClearTerminal() + return false + } + return true +} + func GetUserForBrowser(userInput string) bool { if strings.ToLower(userInput) == "yes" { openBrowser() diff --git a/README.md b/README.md index e17876d..77a32a1 100644 --- a/README.md +++ b/README.md @@ -190,5 +190,9 @@ You can use this command before start: ALLHTTPSERVERS ALL CREATING HTTP SERVERS ALLCREATINGHTTPSERVERS + ALL HTTP CLIENTS + ALLHTTPCLIENTS + ALL CREATING HTTP CLIENTS + ALLCREATINGHTTPCLIENTS πŸŒŽπŸŒπŸŒπŸ€βš½βšΎπŸ₯ŽπŸπŸ”΄πŸŸ πŸŸ‘πŸŸ’πŸ”΅πŸŸ£πŸŸ€πŸ”˜πŸ˜πŸ₯˜πŸ«“πŸ΅πŸ»πŸ…πŸ‘πŸŠπŸˆπŸŒ³β€οΈπŸŽΎπŸ•πŸœπŸΊπŸ«–πŸŽ³πŸŽ–πŸ₯‡πŸ₯ˆπŸ₯‰πŸŽƒπŸ”₯πŸ’§πŸŒˆβ­πŸŒŸπŸŽπŸπŸš‚πŸŸ₯🟧🟨🟩🟦πŸŸͺπŸŸ«πŸ”ΆπŸ”·πŸ’ βœ…πŸ”†βΊβΉπŸ›‘πŸ”’πŸ“ŒπŸ—‚πŸ“‚πŸ’°πŸ“”πŸ“•πŸ“–πŸ“—πŸ“˜πŸ“™πŸ“šπŸ““πŸ“’πŸŽ₯πŸ“½πŸ“ΉπŸ–₯πŸ’»πŸŽΉπŸŽ΅πŸ””πŸ’πŸŽ¨ diff --git a/features/CreatingHTTPClients.go b/features/CreatingHTTPClients.go new file mode 100644 index 0000000..279391f --- /dev/null +++ b/features/CreatingHTTPClients.go @@ -0,0 +1,8 @@ +package features + +var TitleHTTPClients = []string{ + "ALL HTTP CLIENTS", + "ALLHTTPCLIENTS", + "ALL CREATING HTTP CLIENTS", + "ALLCREATINGHTTPCLIENTS", +} \ No newline at end of file diff --git a/features/Printer.go b/features/Printer.go index 263e8f1..fa08d67 100644 --- a/features/Printer.go +++ b/features/Printer.go @@ -4,8 +4,10 @@ import ( "fmt" "strings" "time" - "github.com/fatih/color" + "os/exec" + "runtime" + "os" ) func SplitIntoWords(text string) []string { @@ -40,4 +42,21 @@ func GoodByePrint(){ | GoodBye | β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ `) -} \ No newline at end of file +} + +func ClearTerminal() { + var cmd *exec.Cmd + + switch runtime.GOOS { + case "linux", "darwin": + cmd = exec.Command("clear") + case "windows": + cmd = exec.Command("cmd", "/c", "cls") + default: + fmt.Println("Unsupported operating system") + return + } + + cmd.Stdout = os.Stdout + cmd.Run() +} diff --git a/features/helpMessage.go b/features/helpMessage.go index 1cee10c..69bf3c1 100644 --- a/features/helpMessage.go +++ b/features/helpMessage.go @@ -2,6 +2,8 @@ package features import ( "fmt" + "time" + "github.com/fatih/color" ) @@ -25,6 +27,12 @@ var LOGO string = fmt.Sprintln(` ─────────────── β€’ β€’ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ─────────────────────────────────────────────────────────────────────────────────────────────────────────────`) +var TitleOfHelp = []string{ + "-h", + "help", + "-help", + "--help", +} var Message string = fmt.Sprintln(` my name is Sina LalehBakhsh, I hope this API is useful for you @@ -36,48 +44,69 @@ like this: func HelpMessage() { color.HiBlue(` - β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” - | GoCron v1.0.16 | - β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ - `) +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +| GoCron v1.0.16 | +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜`) words := SplitIntoWords(Message) PrintWordByWord(words) fmt.Println() - color.HiBlue(fmt.Sprintln(`You can use this command before start: - β—‰============ Run - 1- - go run . - - β—‰============ Build - 1- - go build . - 2- - ./Gocron - - β—‰============ Help - ./Gocron -h - ./Gocron help - ./Gocron -help - ./Gocron --help + time.Sleep(time.Second * 2) + color.HiBlue(fmt.Sprintln("You can use this command before start:")) + time.Sleep(time.Second * 2) + color.HiBlue(fmt.Sprintln(`Run + go run . - β—‰============ Show All +Build + go build . + ./Gocron + +Help + ./Gocron -h + ./Gocron help + ./Gocron -help + ./Gocron --help + +Show All ./Gocron all ./Gocron -all - ./Gocron --all - `)) - color.HiCyan(fmt.Sprintln(` - example command after run program: - help + ./Gocron --all`)) + time.Sleep(time.Second * 2) + color.HiCyan(fmt.Sprintln("example command after run program:")) + time.Sleep(time.Second * 2) + color.HiCyan(fmt.Sprintln(` help for example all regex - goroutines and channels - `)) - -} + goroutines and channels`)) + time.Sleep(time.Second * 2) + color.HiMagenta(fmt.Sprintln("if just write one input you get all about that:")) + time.Sleep(time.Second * 2) + color.HiMagenta(fmt.Sprintln(` READING AND WRITING DATA + READINGANDWRITINGDATA + ALL READING AND WRITING DATA + ALLREADINGANDWRITINGDATA + ALL REGEX + ALLREGEX + ALL TIME + ALLTIME + ALL HTML AND TEMPLATE + ALLHTMLANDTEMPLATE + ALL WORKING WITH FILES + ALLWORKINGWITHFILES + ALL JSON + ALLJSON + ALL JSON DATA + ALLJSONDATA + ALL WORK WITH JSON DATA + ALLWORKWITHJSONDATA + ALL WORKING WITH JSON DATA + ALLWORKINGWITHJSONDATA + ALL HTTP SERVERS + ALLHTTPSERVERS + ALL CREATING HTTP SERVERS + ALLCREATINGHTTPSERVERS + ALL HTTP CLIENTS + ALLHTTPCLIENTS + ALL CREATING HTTP CLIENTS + ALLCREATINGHTTPCLIENTS`)) -var TitleOfHelp = []string{ - "-h", - "help", - "-help", - "--help", }