MCPcopy Index your code
hub / github.com/rclone/rclone / ShellExpand

Function ShellExpand

lib/env/env.go:16–27  ·  view source on GitHub ↗

ShellExpand replaces a leading "~" with the home directory" and expands all environment variables afterwards.

(s string)

Source from the content-addressed store, hash-verified

14// ShellExpand replaces a leading "~" with the home directory" and
15// expands all environment variables afterwards.
16func ShellExpand(s string) string {
17 if s != "" {
18 if s[0] == '~' {
19 newS, err := homedir.Expand(s)
20 if err == nil {
21 s = newS
22 }
23 }
24 s = os.ExpandEnv(s)
25 }
26 return s
27}
28
29// CurrentUser finds the current user name or "" if not found
30func CurrentUser() (userName string) {

Callers 6

NewFsFunction · 0.92
NewClientFunction · 0.92
createOAuthClientFunction · 0.92
NewFsFunction · 0.92
configureMethod · 0.92
TestShellExpandFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestShellExpandFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…