diff --git a/packages.dhall b/packages.dhall deleted file mode 100644 index bba651a..0000000 --- a/packages.dhall +++ /dev/null @@ -1,24 +0,0 @@ -let upstream = - https://github.com/purescript/package-sets/releases/download/psc-0.15.0-20220507/packages.dhall - sha256:cf54330f3bc1b25a093b69bff8489180c954b43668c81288901a2ec29a08cc64 - with open-memoize = - { dependencies = - [ "console" - , "effect" - , "psci-support" - , "strings" - , "lists" - , "either" - , "integers" - , "lazy" - , "maybe" - , "partial" - , "prelude" - , "tuples" - ] - , repo = - "https://github.com/purescript-open-community/purescript-open-memoize.git" - , version = "v6.1.0" - } - -in upstream diff --git a/spago.dhall b/spago.dhall deleted file mode 100644 index bcb0651..0000000 --- a/spago.dhall +++ /dev/null @@ -1,40 +0,0 @@ -{ name = "optparse" -, dependencies = - [ "prelude" - , "effect" - , "exitcodes" - , "strings" - , "arrays" - , "console" - , "open-memoize" - , "transformers" - , "exists" - , "node-process" - , "free" - , "quickcheck" - , "spec" - , "aff" - , "bifunctors" - , "control" - , "either" - , "enums" - , "foldable-traversable" - , "gen" - , "integers" - , "lazy" - , "lists" - , "maybe" - , "newtype" - , "node-buffer" - , "node-streams" - , "nonempty" - , "numbers" - , "partial" - , "tailrec" - , "tuples" - ] -, packages = ./packages.dhall -, sources = [ "src/**/*.purs", "test/**/*.purs" ] -, license = "BSD-3-Clause" -, repository = "https://github.com/f-o-a-m/purescript-optparse" -} diff --git a/spago.yaml b/spago.yaml new file mode 100644 index 0000000..84b3ef3 --- /dev/null +++ b/spago.yaml @@ -0,0 +1,46 @@ +package: + dependencies: + - aff: ">=7.1.0 <8.0.0" + - arrays: ">=7.2.1 <8.0.0" + - bifunctors: ">=6.0.0 <7.0.0" + - console: ">=6.1.0 <7.0.0" + - control: ">=6.0.0 <7.0.0" + - effect: ">=4.0.0 <5.0.0" + - either: ">=6.1.0 <7.0.0" + - enums: ">=6.0.1 <7.0.0" + - exists: ">=6.0.0 <7.0.0" + - exitcodes: ">=4.0.0 <5.0.0" + - foldable-traversable: ">=6.0.0 <7.0.0" + - free: ">=7.1.0 <8.0.0" + - gen: ">=4.0.0 <5.0.0" + - integers: ">=6.0.0 <7.0.0" + - lazy: ">=6.0.0 <7.0.0" + - lists: ">=7.0.0 <8.0.0" + - maybe: ">=6.0.0 <7.0.0" + - newtype: ">=5.0.0 <6.0.0" + - node-buffer: ">=9.0.0 <10.0.0" + - node-process: ">=11.2.0 <12.0.0" + - node-streams: ">=9.0.0 <10.0.0" + - nonempty: ">=7.0.0 <8.0.0" + - numbers: ">=9.0.1 <10.0.0" + - open-memoize: ">=6.1.0 <7.0.0" + - partial: ">=4.0.0 <5.0.0" + - prelude: ">=6.0.1 <7.0.0" + - strings: ">=6.0.1 <7.0.0" + - tailrec: ">=6.1.0 <7.0.0" + - transformers: ">=6.0.0 <7.0.0" + - tuples: ">=7.0.0 <8.0.0" + name: optparse + publish: + version: 5.0.1 + license: BSD-3-Clause + location: + githubOwner: "purescript-contrib" + githubRepo: purescript-optparse + test: + dependencies: [ "quickcheck", "spec" ] + main: Test.Main +workspace: + extra_packages: {} + package_set: + registry: 43.3.0 diff --git a/src/Options/Applicative/Extra.purs b/src/Options/Applicative/Extra.purs index 1585827..5adf42d 100644 --- a/src/Options/Applicative/Extra.purs +++ b/src/Options/Applicative/Extra.purs @@ -40,7 +40,7 @@ import Effect (Effect) import ExitCodes (ExitCode) import ExitCodes as ExitCode import Node.Encoding (Encoding(..)) -import Node.Process (argv, exit, stderr, stdout) +import Node.Process (argv, exit', stderr, stdout) import Node.Stream as Stream import Options.Applicative.BashCompletion (bashCompletionParser) import Options.Applicative.Builder (abortOption, defaultPrefs, help, hidden, long, metavar, short) @@ -61,10 +61,10 @@ getProgName = argv <#> \args -> fromMaybe "" do Array.last $ String.split (String.Pattern "/") executablePath exitSuccess :: forall t270. Effect t270 -exitSuccess = exit $ fromEnum ExitCode.Success +exitSuccess = exit' $ fromEnum ExitCode.Success exitWith :: forall void. ExitCode -> Effect void -exitWith c = exit $ fromEnum c +exitWith c = exit' $ fromEnum c -- | A hidden "helper" option which always fails. Use this to -- | add the `--help` flag to your CLI parser @@ -116,12 +116,12 @@ handleParseResult (Failure failure) = do stream = case exit of ExitCode.Success -> stdout _ -> stderr - void $ Stream.writeString stream UTF8 (msg <> "\n") mempty + void $ Stream.writeString stream UTF8 (msg <> "\n") exitWith exit handleParseResult (CompletionInvoked compl) = do progn <- getProgName msg <- (un CompletionResult compl).execCompletion progn - void $ Stream.writeString stdout UTF8 msg mempty + void $ Stream.writeString stdout UTF8 msg exitSuccess -- | Extract the actual result from a `ParserResult` value.