Package

purescript-which

Repository
maxdeviant/purescript-which
License
MIT
Uploaded by
maxdeviant
Published on
2022-07-23T19:53:14Z

Pursuit

PureScript bindings for which.

Installation

spago install which

You will also need to have which installed:

Yarn

yarn add which

npm

npm i which

Usage

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