Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from everettraven/feature/alias_v1
Browse files Browse the repository at this point in the history
alias adjust again
  • Loading branch information
everettraven authored Jun 2, 2021
2 parents f2e9316 + 97b25dc commit 996631c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions subcommands/alias_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ import (
"bufio"
"io"
"os"
"path/filepath"
)

//AddAlias will add the alias for the package name specified
func AddAliasUnix(name string, ed string) error {

//get the bash aliases file path
path, err := filepath.Abs("~/.bash_aliases")
home, err := os.UserHomeDir()

if err != nil {
return nil
}

path := home + "/.bash_aliases"

//If run on linux lets modify the bash aliases file to include the new aliases
file, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE, 0755)

Expand All @@ -42,12 +43,14 @@ func AddAliasUnix(name string, ed string) error {
func RemoveAliasUnix(name string, ed string) error {

//get the bash aliases file path
path, err := filepath.Abs("~/.bash_aliases")
home, err := os.UserHomeDir()

if err != nil {
return nil
}

path := home + "/.bash_aliases"

//If it isnt windows, remove it from the bash aliases file
file, err := os.OpenFile(path, os.O_RDWR, 0755)

Expand Down

0 comments on commit 996631c

Please sign in to comment.