~fmac/corylus

ref: 0a6019d236e40f5e872b340b4862175c1e542a74 corylus/misc.go -rw-r--r-- 266 bytes
0a6019d2 — Francesco Camuffo Add seg cwd-count 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package main

import (
	"os"
	"os/user"
)

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
}