MCPcopy Index your code
hub / github.com/mislav/hub / authTokenNote

Function authTokenNote

github/client.go:1307–1333  ·  view source on GitHub ↗
(num int)

Source from the content-addressed store, hash-verified

1305}
1306
1307func authTokenNote(num int) (string, error) {
1308 n := os.Getenv("USER")
1309
1310 if n == "" {
1311 n = os.Getenv("USERNAME")
1312 }
1313
1314 if n == "" {
1315 whoami := exec.Command("whoami")
1316 whoamiOut, err := whoami.Output()
1317 if err != nil {
1318 return "", err
1319 }
1320 n = strings.TrimSpace(string(whoamiOut))
1321 }
1322
1323 h, err := os.Hostname()
1324 if err != nil {
1325 return "", err
1326 }
1327
1328 if num > 1 {
1329 return fmt.Sprintf("hub for %s@%s %d", n, h, num), nil
1330 }
1331
1332 return fmt.Sprintf("hub for %s@%s", n, h), nil
1333}
1334
1335func perPage(limit, max int) int {
1336 if limit > 0 {

Callers 2

TestAuthTokenNoteFunction · 0.85
FindOrCreateTokenMethod · 0.85

Calls 1

OutputMethod · 0.80

Tested by 1

TestAuthTokenNoteFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…