mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-12-20 02:15:12 -07:00
626bde0a97
* Enable `remove_command.bats` tests * Update `remove_command.bats` to use new command name * Create `internal/data` package * Use data package for install paths * Get all asdf plugin remove command BATS tests passing
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
// Package data provides constants and functions pertaining to directories and
|
|
// files in the asdf data directory on disk, specified by the $ASDF_DATA_DIR
|
|
package data
|
|
|
|
import (
|
|
"path/filepath"
|
|
)
|
|
|
|
const (
|
|
dataDirDownloads = "downloads"
|
|
dataDirInstalls = "installs"
|
|
dataDirPlugins = "plugins"
|
|
)
|
|
|
|
// DownloadDirectory returns the directory a plugin will be placing
|
|
// downloads of version source code
|
|
func DownloadDirectory(dataDir, pluginName string) string {
|
|
return filepath.Join(dataDir, dataDirDownloads, pluginName)
|
|
}
|
|
|
|
// InstallDirectory returns the path to a plugin directory
|
|
func InstallDirectory(dataDir, pluginName string) string {
|
|
return filepath.Join(dataDir, dataDirInstalls, pluginName)
|
|
}
|
|
|
|
// PluginsDirectory returns the path to the plugins directory in the data dir
|
|
func PluginsDirectory(dataDir string) string {
|
|
return filepath.Join(dataDir, dataDirPlugins)
|
|
}
|
|
|
|
// PluginDirectory returns the directory a plugin with a given name would be in
|
|
// if it were installed
|
|
func PluginDirectory(dataDir, pluginName string) string {
|
|
return filepath.Join(dataDir, dataDirPlugins, pluginName)
|
|
}
|