PureScript bindings for which
.
spago install which
You will also need to have which
installed:
yarn add which
npm i which
module Main where
import Prelude
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Console (log)
import Which (whichSync)
main :: Effect Unit
main = do
let
commandToFind = "neofetch"
command <- whichSync Nothing commandToFind
log
$ case command of
Just found -> "Found " <> commandToFind <> " at " <> found
Nothing -> "Did not find " <> commandToFind
module Main where
import Prelude
import Data.Maybe (Maybe(..))
import Data.Options ((:=))
import Effect (Effect)
import Effect.Console (log)
import Which (whichSync, path)
main :: Effect Unit
main = do
let
commandToFind = "neofetch"
command <- whichSync (Just $ path := Just ".") commandToFind
log
$ case command of
Just found -> "Found " <> commandToFind <> " at " <> found
Nothing -> "Did not find " <> commandToFind