https://github.com/maxdeviant/purescript-which
PureScript bindings for `which`
https://github.com/maxdeviant/purescript-which
Last synced: about 1 month ago
JSON representation
PureScript bindings for `which`
- Host: GitHub
- URL: https://github.com/maxdeviant/purescript-which
- Owner: maxdeviant
- License: mit
- Created: 2020-09-23T03:14:11.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-07-23T19:54:21.000Z (over 3 years ago)
- Last Synced: 2025-04-09T15:16:53.555Z (11 months ago)
- Language: PureScript
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# purescript-which
[](https://pursuit.purescript.org/packages/purescript-which)
PureScript bindings for [`which`](https://www.npmjs.com/package/which).
## Installation
```
spago install which
```
You will also need to have [`which`](https://www.npmjs.com/package/which) installed:
#### Yarn
```
yarn add which
```
#### npm
```
npm i which
```
## Usage
```purs
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
```
```purs
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
```