~fmac/corylus

ref: 1558e2016ceb11a8bdb5daf07657629fbf798178 corylus/misc.go -rw-r--r-- 277 bytes
1558e201 — Francesco Camuffo Add cwd.go 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"os"
	"os/user"
	"strings"
)

func segHostname() (string, error) {
	return os.Hostname()
}

func segTail() (string, error) {
	u, err := user.Current()
	if err != nil {
		return "", err
	}
	if u.Uid == "0" {
		return "\n# ", nil
	}
	return "\n$ ", nil
}