Skip to content

Commit

Permalink
fixed logic bug in cheat installation
Browse files Browse the repository at this point in the history
- fixed batcat symlink logic on linux
  • Loading branch information
Phillip Miller committed Oct 17, 2021
1 parent f2a9a88 commit 352c818
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [v1.5.2](https://github.com/mr-pmillz/pimp-my-shell/tree/v1.5.2) (2021-10-17)

[Full Changelog](https://github.com/mr-pmillz/pimp-my-shell/compare/v1.4.5...v1.5.2)

## [v1.4.5](https://github.com/mr-pmillz/pimp-my-shell/tree/v1.4.5) (2021-10-16)

[Full Changelog](https://github.com/mr-pmillz/pimp-my-shell/compare/v1.5.1...v1.4.5)

## [v1.5.1](https://github.com/mr-pmillz/pimp-my-shell/tree/v1.5.1) (2021-10-16)

[Full Changelog](https://github.com/mr-pmillz/pimp-my-shell/compare/v1.5.0...v1.5.1)
Expand Down
2 changes: 1 addition & 1 deletion cheat/cheat.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func InstallCheat(osType string, dirs *localio.Directories, packages *localio.In
if _, exists := localio.CommandExists("cheat"); !exists {
fmt.Println("[+] Installing cheat")
if _, exists = localio.CommandExists("go"); !exists {
if cheatConfigExists, err := localio.Exists("~/.config/cheat"); err != nil && !cheatConfigExists {
if cheatConfigExists, err := localio.Exists("~/.config/cheat"); err == nil && !cheatConfigExists {
if err := localio.RunCommandPipeOutput("go get -u github.com/cheat/cheat/cmd/cheat"); err != nil {
return err
}
Expand Down
8 changes: 6 additions & 2 deletions extra/extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ func InstallExtraPackages(osType string, dirs *localio.Directories, packages *lo
if err := localio.RunCommandPipeOutput(fmt.Sprintf("mkdir -p %s/.local/bin", dirs.HomeDir)); err != nil {
return err
}
if err := localio.RunCommandPipeOutput(fmt.Sprintf("ln -s /usr/bin/batcat %s/.local/bin/bat", dirs.HomeDir)); err != nil {
return err

if exists, err := localio.Exists(fmt.Sprintf("%s/.local/bin/bat", dirs.HomeDir)); err == nil && !exists {
if err := localio.RunCommandPipeOutput(fmt.Sprintf("ln -sf /usr/bin/batcat %s/.local/bin/bat", dirs.HomeDir)); err != nil {
return err
}
}


// install fzf configuration
if exists, err := localio.Exists(fmt.Sprintf("%s/.fzf", dirs.HomeDir)); err == nil && !exists {
installString := fmt.Sprintf("git clone --depth 1 https://github.com/junegunn/fzf.git %s/.fzf && %s/.fzf/install --all", dirs.HomeDir, dirs.HomeDir)
Expand Down
2 changes: 1 addition & 1 deletion zsh/zsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func InstallOhMyZsh(osType string, dirs *localio.Directories) error {
default:
// Do Nothing
}

if err = localio.RunCommandPipeOutput(fmt.Sprintf("cd %s && sh %s --keep-zshrc --unattended || true", dirs.HomeDir, dest)); err != nil {
return err
}
Expand Down

0 comments on commit 352c818

Please sign in to comment.