shellmet 0.0.1 → 0.0.2.0
raw patch · 5 files changed
+41/−43 lines, 5 files
Files
- CHANGELOG.md +5/−0
- README.lhs +2/−2
- README.md +2/−2
- shellmet.cabal +17/−39
- src/Shellmet.hs +15/−0
CHANGELOG.md view
@@ -3,6 +3,11 @@ `shellmet` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +## 0.0.2.0 — Jul 4, 2019++* [#8](https://github.com/kowainik/shellmet/issues/8):+ Implement `$^` operator that doesn't print the command to terminal.+ ## 0.0.1 — Apr 9, 2019 * Generalise the type of the `$?` operator to allow returning values on
README.lhs view
@@ -1,7 +1,7 @@ # shellmet -[](https://travis-ci.org/kowainik/shellmet)-[](https://hackage.haskell.org/package/shellmet)+[](https://travis-ci.org/kowainik/shellmet)+[](https://hackage.haskell.org/package/shellmet) [](LICENSE) [](http://stackage.org/lts/package/shellmet) [](http://stackage.org/nightly/package/shellmet)
README.md view
@@ -1,7 +1,7 @@ # shellmet -[](https://travis-ci.org/kowainik/shellmet)-[](https://hackage.haskell.org/package/shellmet)+[](https://travis-ci.org/kowainik/shellmet)+[](https://hackage.haskell.org/package/shellmet) [](LICENSE) [](http://stackage.org/lts/package/shellmet) [](http://stackage.org/nightly/package/shellmet)
shellmet.cabal view
@@ -1,14 +1,14 @@-cabal-version: 2.0+cabal-version: 2.4 name: shellmet-version: 0.0.1+version: 0.0.2.0 synopsis: Out of the shell solution for scripting in Haskell description: Shellmet provides easy and convenient way to call shell commands from Haskell programs homepage: https://github.com/kowainik/shellmet bug-reports: https://github.com/kowainik/shellmet/issues license: MPL-2.0 license-file: LICENSE-author: Kowainik-maintainer: xrom.xkov@gmail.com+author: Dmitrii Kovanikov+maintainer: Kowainik <xrom.xkov@gmail.com> copyright: 2019 Kowainik category: Shell, Command Line build-type: Simple@@ -16,19 +16,14 @@ , CHANGELOG.md tested-with: GHC == 8.2.2 GHC == 8.4.4- GHC == 8.6.3+ GHC == 8.6.5 source-repository head type: git location: https://github.com/kowainik/shellmet.git -library- hs-source-dirs: src- exposed-modules: Shellmet-+common common-options build-depends: base >= 4.10.1.0 && < 4.13- , process ^>= 1.6.3- , text ^>= 1.2.3 ghc-options: -Wall -Wincomplete-uni-patterns@@ -53,6 +48,14 @@ TypeApplications ViewPatterns +library+ import: common-options+ hs-source-dirs: src+ exposed-modules: Shellmet++ build-depends: process ^>= 1.6.3+ , text ^>= 1.2.3+ executable readme main-is: README.lhs build-depends: base@@ -64,36 +67,11 @@ default-language: Haskell2010 test-suite shellmet-test+ import: common-options type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Spec.hs - build-depends: base >= 4.10.1.0 && < 4.13- , shellmet--- ghc-options: -Wall- -threaded- -rtsopts- -with-rtsopts=-N- -Wincomplete-uni-patterns- -Wincomplete-record-updates- -Wcompat- -Widentities- -Wredundant-constraints- -fhide-source-paths+ build-depends: shellmet - default-language: Haskell2010- default-extensions: ConstraintKinds- DeriveGeneric- GeneralizedNewtypeDeriving- InstanceSigs- KindSignatures- LambdaCase- OverloadedStrings- RecordWildCards- ScopedTypeVariables- StandaloneDeriving- TupleSections- TypeApplications- ViewPatterns+ ghc-options: -threaded -rtsopts -with-rtsopts=-N
src/Shellmet.hs view
@@ -13,6 +13,7 @@ module Shellmet ( ($|)+ , ($^) , ($?) ) where @@ -45,6 +46,7 @@ let cmdStr = showCommandForUser cmd (map T.unpack args) putStrLn $ "⚙ " ++ cmdStr callCommand cmdStr+ {-# INLINE fromString #-} {- | Run shell command with given options and return stripped stdout of the executed command.@@ -55,7 +57,19 @@ infix 5 $| ($|) :: FilePath -> [Text] -> IO Text cmd $| args = T.strip . T.pack <$> readProcess cmd (map T.unpack args) ""+{-# INLINE ($|) #-} +{- | This operator runs shell command with given options but doesn't print the+command itself.++>>> "echo" $^ ["Foo", "Bar"]+Foo Bar+-}+infix 5 $^+($^) :: FilePath -> [Text] -> IO ()+cmd $^ args = callCommand $ showCommandForUser cmd (map T.unpack args)+{-# INLINE ($^) #-}+ {- | Do some IO actions when process failed with 'IOError'. >>> "exit" ["0"] $? putStrLn "Command failed"@@ -68,3 +82,4 @@ infixl 4 $? ($?) :: IO a -> IO a -> IO a action $? handler = action `catch` \(_ :: IOError) -> handler+{-# INLINE ($?) #-}