summaryrefslogtreecommitdiff
path: root/internal/install/bash.go
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2019-11-19 05:16:51 +0200
committerEyal Posener <[email protected]>2019-11-19 05:17:52 +0200
commitc3bfbddfe6b4d133259ee84a9f0f93a7d1b0971e (patch)
treed19ec98986d382d17f040787fb9f851b0b97b6fd /internal/install/bash.go
parentca6cedb61484d2a211c105900f663e355b13626a (diff)
Move install package back to project root
Diffstat (limited to 'internal/install/bash.go')
-rw-r--r--internal/install/bash.go37
1 files changed, 0 insertions, 37 deletions
diff --git a/internal/install/bash.go b/internal/install/bash.go
deleted file mode 100644
index 17c64de..0000000
--- a/internal/install/bash.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package install
-
-import "fmt"
-
-// (un)install in bash
-// basically adds/remove from .bashrc:
-//
-// complete -C </path/to/completion/command> <command>
-type bash struct {
- rc string
-}
-
-func (b bash) IsInstalled(cmd, bin string) bool {
- completeCmd := b.cmd(cmd, bin)
- return lineInFile(b.rc, completeCmd)
-}
-
-func (b bash) Install(cmd, bin string) error {
- if b.IsInstalled(cmd, bin) {
- return fmt.Errorf("already installed in %s", b.rc)
- }
- completeCmd := b.cmd(cmd, bin)
- return appendToFile(b.rc, completeCmd)
-}
-
-func (b bash) Uninstall(cmd, bin string) error {
- if !b.IsInstalled(cmd, bin) {
- return fmt.Errorf("does not installed in %s", b.rc)
- }
-
- completeCmd := b.cmd(cmd, bin)
- return removeFromFile(b.rc, completeCmd)
-}
-
-func (bash) cmd(cmd, bin string) string {
- return fmt.Sprintf("complete -C %s %s", bin, cmd)
-}