From 703dd6ebc30f7c6f5a5c02e07a307e0e34d9c2c2 Mon Sep 17 00:00:00 2001 From: Eyal Posener Date: Sat, 6 May 2017 22:06:49 +0300 Subject: improve docs --- install/install.go | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 install/install.go (limited to 'install/install.go') 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) -} -- cgit v1.2.3