diff --git a/commands/path.go b/commands/path.go index 1aa70833..5ab636ee 100644 --- a/commands/path.go +++ b/commands/path.go @@ -12,6 +12,18 @@ func gitLineEnding(git env) string { } } +const ( + windowsPrefix = `.\` + nixPrefix = `./` +) + +func trimCurrentPrefix(p string) string { + if strings.HasPrefix(p, windowsPrefix) { + return strings.TrimPrefix(p, windowsPrefix) + } + return strings.TrimPrefix(p, nixPrefix) +} + type env interface { Get(string) (string, bool) }