Add some comments
parent
2445277b60
commit
557558cc88
5
main.go
5
main.go
|
@ -16,8 +16,10 @@ func main() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// User status is written to ~/.venture
|
||||||
outputPath := path.Join(curUser.HomeDir, ".venture")
|
outputPath := path.Join(curUser.HomeDir, ".venture")
|
||||||
|
|
||||||
|
// Prompt user for input
|
||||||
fmt.Printf("What's ~%v been up to?\n~%v", curUser.Username, curUser.Username)
|
fmt.Printf("What's ~%v been up to?\n~%v", curUser.Username, curUser.Username)
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
input, err := reader.ReadString('\n')
|
input, err := reader.ReadString('\n')
|
||||||
|
@ -25,6 +27,7 @@ func main() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove file on blank input
|
||||||
if len(input) < 1 {
|
if len(input) < 1 {
|
||||||
err = os.Remove(outputPath)
|
err = os.Remove(outputPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -33,8 +36,10 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prepend status with user's name
|
||||||
input = "~"+curUser.Username+input
|
input = "~"+curUser.Username+input
|
||||||
|
|
||||||
|
// Write file and create if it doesn't exist as world-readable.
|
||||||
err = ioutil.WriteFile(outputPath, []byte(input), 0644)
|
err = ioutil.WriteFile(outputPath, []byte(input), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in New Issue