summaryrefslogtreecommitdiff
path: root/install/install.go
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2017-05-06 22:21:03 +0300
committerGitHub <[email protected]>2017-05-06 22:21:03 +0300
commitc26ef096c7990a5ae97b503545fd76ff6df388d6 (patch)
treed0180b667269b985d15520f3b2e1aafc9292af6e /install/install.go
parent2b6aed2b1e974a733c0dc614a9617c33a54c208c (diff)
parent404634e843081e7010260bd95006b84d6c40a8fd (diff)
Merge pull request #4 from posener/doc
Doc
Diffstat (limited to 'install/install.go')
-rw-r--r--install/install.go43
1 files changed, 0 insertions, 43 deletions
diff --git a/install/install.go b/install/install.go
deleted file mode 100644
index cef11f0..0000000
--- a/install/install.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package install
-
-import (
- "os"
- "path/filepath"
-)
-
-type installer interface {
- Install(cmd, bin string) error
- Uninstall(cmd, bin string) error
-}
-
-func Install(cmd string, asRoot bool) error {
- bin, err := getBinaryPath()
- if err != nil {
- return err
- }
- return getInstaller(asRoot).Install(cmd, bin)
-}
-
-func Uninstall(cmd string, asRoot bool) error {
- bin, err := getBinaryPath()
- if err != nil {
- return err
- }
- return getInstaller(asRoot).Uninstall(cmd, bin)
-}
-
-func getInstaller(asRoot bool) installer {
- if asRoot {
- return root{}
- } else {
- return home{}
- }
-}
-
-func getBinaryPath() (string, error) {
- bin, err := os.Executable()
- if err != nil {
- return "", err
- }
- return filepath.Abs(bin)
-}