auto add trailing slash to path to clone to

This commit is contained in:
Jay Gabriels 2020-01-19 12:42:00 -08:00
parent c9032b0854
commit d0ce81dfc5
No known key found for this signature in database
GPG Key ID: 47EC2E34963C2D56
3 changed files with 8 additions and 2 deletions

View File

@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
## [Unreleased] - DATE
### Added
- auto add trailing slash to path to clone to if not supplied by user
### Changed
### Deprecated
### Removed

View File

@ -123,7 +123,12 @@ func getOrSetDefaults(envVar string) {
os.Setenv(envVar, "false")
}
} else {
os.Setenv(envVar, viper.GetString(envVar))
// User forgot to put a / at the end of path, so we will add for them
if envVar == "GHORG_ABSOLUTE_PATH_TO_CLONE_TO" && !strings.HasSuffix(viper.GetString(envVar), "/") {
os.Setenv(envVar, viper.GetString(envVar)+"/")
} else {
os.Setenv(envVar, viper.GetString(envVar))
}
}
}

View File

@ -1,5 +1,5 @@
---
# This is where your *_ghorg directory will be created, use absolute pathing. Must end with /
# This is where your *_ghorg directory will be created, use absolute pathing. Must end with /, if not one will be added for you
# default: $HOME/Desktop/
# flag (--path, -p)
GHORG_ABSOLUTE_PATH_TO_CLONE_TO: