Skip to content

Commit

Permalink
fix: Don't warp to current directory
Browse files Browse the repository at this point in the history
  • Loading branch information
NoUseFreak committed Dec 27, 2023
1 parent 348ed83 commit dd6987d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/warp.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ func getWarpCmd() *cobra.Command {
return warp(cmd.OutOrStdout(), name, target)
}

if !isatty.IsTerminal(os.Stdin.Fd()) {
return cmd.Root().Usage()
}
if !isatty.IsTerminal(os.Stdin.Fd()) {
return cmd.Root().Usage()
}

data := newFzfItemSlice(index)
idx, err := fuzzyfinder.Find(
Expand All @@ -63,6 +63,12 @@ func getWarpCmd() *cobra.Command {
}

func warp(o io.Writer, name string, path string) error {
curdir, _ := os.Getwd()
if curdir == path {
logrus.Infof("Already in %s", path)
return nil
}

recordHistory(name)

logrus.Infof("Warping to %s", path)
Expand Down

0 comments on commit dd6987d

Please sign in to comment.