MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / readToken

Function readToken

internal/nodeenroll/cmd.go:168–181  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

166}
167
168func readToken(path string) (string, error) {
169 if path == "-" {
170 b, err := io.ReadAll(os.Stdin)
171 if err != nil {
172 return "", err
173 }
174 return strings.TrimSpace(string(b)), nil
175 }
176 b, err := os.ReadFile(path)
177 if err != nil {
178 return "", err
179 }
180 return strings.TrimSpace(string(b)), nil
181}

Callers 3

RunCLIFunction · 0.85
TestReadToken_FromFileFunction · 0.85
TestReadToken_FromStdinFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestReadToken_FromFileFunction · 0.68
TestReadToken_FromStdinFunction · 0.68