Basic functionality
parent
7439ed3160
commit
6d83f4cdd9
|
@ -0,0 +1 @@
|
|||
Venture
|
|
@ -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
26
main.go
|
@ -2,8 +2,32 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"path"
|
||||
"os"
|
||||
"os/user"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"bufio"
|
||||
)
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue