mirror of
https://github.com/mudabbir-ahmad/LearningGo.git
synced 2026-10-07 17:50:20 +00:00
sumn light
This commit is contained in:
1 parent
f0f92c276f
commit
e53f7b5436
3 files changed
+50
-11
No files matched your search
@@ -1,3 +1,49 @@
|
||||
package main
|
||||
|
||||
func main() {}
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a reader
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
|
||||
//Create a file path:
|
||||
err := os.Mkdir("./Log", os.ModePerm)
|
||||
|
||||
check(err)
|
||||
|
||||
path := filepath.Join("./Log", "TerminalLog.txt")
|
||||
file, _ := os.Create(path) // Creating the file and assinging it the variable file
|
||||
|
||||
// Create a writer
|
||||
writer := bufio.NewWriter(file)
|
||||
|
||||
// The rest.
|
||||
fmt.Println("Enter in commands you were to run in the terminal, this go file acts as a middle man recorder: \n")
|
||||
input, _ := reader.ReadString('.')
|
||||
|
||||
var inputs []string
|
||||
|
||||
cleanedInput := strings.Split(inputs, "\n")
|
||||
|
||||
writer.WriteString(cleanedInput)
|
||||
|
||||
term.NewTerminal(_, input) * Terminal
|
||||
|
||||
defer writer.Flush()
|
||||
defer file.Close()
|
||||
|
||||
}
|
||||
|
||||
func check(e error) {
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user