flip-cmd (empty) → 0.1.0.0
raw patch · 4 files changed
+78/−0 lines, 4 filesdep +basedep +processdep +safe-exceptionssetup-changed
Dependencies added: base, process, safe-exceptions
Files
- LICENSE +21/−0
- Setup.hs +2/−0
- app/Main.hs +23/−0
- flip-cmd.cabal +32/−0
+ LICENSE view
@@ -0,0 +1,21 @@+The MIT License (MIT)++Copyright (c) 2018 aiya000++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in+all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+THE SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ app/Main.hs view
@@ -0,0 +1,23 @@+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE ScopedTypeVariables #-}++module Main where++import Control.Exception.Safe (MonadCatch, SomeException, catch)+import System.Environment (getArgs)+import System.Exit (exitFailure)+import System.Process (callCommand)++main :: IO ()+main = suppressErrMsg body+ where+ catch' :: MonadCatch m => m a -> (SomeException -> m a) -> m a+ catch' = catch++ suppressErrMsg :: IO () -> IO ()+ suppressErrMsg m = m `catch'` const exitFailure++ body :: IO ()+ body = getArgs >>= \case+ (cmd:x1:x2:xs) -> callCommand $ unwords (cmd:x2:x1:xs)+ xs -> callCommand $ unwords xs
+ flip-cmd.cabal view
@@ -0,0 +1,32 @@+-- This file has been generated from package.yaml by hpack version 0.20.0.+--+-- see: https://github.com/sol/hpack+--+-- hash: 0a67dc349268ffe37521b0bdc6e799813e793efd5e9c42ab56d94ee501c5398a++name: flip-cmd+version: 0.1.0.0+synopsis: e.g. `flip systemctl foo.service start` does `systemctl start foo.service`+description: Haskell's flip function in our CLI+category: Simple+homepage: https://github.com/aiya000/hs-flip-cmd+author: aiya000+maintainer: aiya000 <aiya000.develop@gmail.com>+copyright: aiya000+license: MIT+license-file: LICENSE+build-type: Simple+cabal-version: >= 1.10++executable flip+ main-is: Main.hs+ hs-source-dirs:+ app+ ghc-options: -Wall -Wno-name-shadowing -Wno-unused-do-bind -Wno-orphans -fprint-potential-instances -fprint-explicit-kinds -threaded -rtsopts -with-rtsopts=-N+ build-depends:+ base >=4.7 && <5+ , process+ , safe-exceptions+ other-modules:+ Paths_flip_cmd+ default-language: Haskell2010