Basic functionality

main
diff 2020-11-12 22:06:19 +00:00
parent 7439ed3160
commit 6d83f4cdd9
3 changed files with 33 additions and 1 deletions

1
.gitignore vendored 100644
View File

@ -0,0 +1 @@
Venture

7
README.md 100644
View File

@ -0,0 +1,7 @@
# Venture
A way to let other people know what the heck you're up to.
## Usage:
`venture "<username>[message]"`

26
main.go
View File

@ -2,8 +2,32 @@ package main
import ( import (
"fmt" "fmt"
"path"
"os"
"os/user"
"io"
"io/ioutil"
"bufio"
) )
func main() { func main() {
fmt.Println("Hello, world!") curUser, err := user.Current()
if err != nil {
panic(err)
}
fmt.Printf("What's ~%v been up to?\n~%v", curUser.Username, curUser.Username)
reader := bufio.NewReader(os.Stdin)
input, err := reader.ReadString('\n')
if err != nil && err != io.EOF {
panic(err)
}
input = "~"+curUser.Username+input
outputPath := path.Join(curUser.HomeDir, ".venture")
err = ioutil.WriteFile(outputPath, []byte(input), 0644)
if err != nil {
panic(err)
}
} }