Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Effectful/CLI/IO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import Effectful.Error.Static (Error, throwError)
import Effectful.Process (Process, callProcess)
import Effectful.Reader.Static (Reader, ask)
import System.IO (hFlush, stderr)
import System.Info (os)
import Text.Layout.Table (columnHeaderTableS, def, rowsG, tableString, titlesH, unicodeS)
import Text.Megaparsec (Parsec, eof, errorBundlePretty, runParser, (<|>))
import Text.Megaparsec.Char (string')
Expand Down Expand Up @@ -139,15 +140,15 @@ withConfirm action = do
unless ok $ throwError (UserCanceled Nothing)
action

-- | Open a file or URL with @xdg-open@.
-- | Open a file or URL with @open@ on macOS, @xdg-open@ elsewhere.
--
-- @since 0.1.0.0
autoOpen
:: Process :> es
=> String
-- ^ file path or URL
-> Eff es ()
autoOpen arg = callProcess "xdg-open" [arg]
autoOpen arg = callProcess (if os == "darwin" then "open" else "xdg-open") [arg]

-- | Let the user pick one item from a table; a single item is returned without prompting, none throws 'NotFoundError'.
--
Expand Down
Loading