cli-setup 0.2.1.0 → 0.2.1.1
raw patch · 3 files changed
+24/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- cli-setup.cabal +1/−1
- src/Distribution/CommandLine.hs +19/−5
CHANGELOG.md view
@@ -1,5 +1,9 @@ # cli-setup +# 0.2.1.1++ * Install to `/usr/local/share/man/man1` on Mac+ # 0.2.1.0 * Add `setManpathBash` & co., deprecate `setManpath`
cli-setup.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: cli-setup-version: 0.2.1.0+version: 0.2.1.1 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018-2019 Vanessa McHale
src/Distribution/CommandLine.hs view
@@ -15,6 +15,7 @@ import Data.FileEmbed (embedStringFile) import System.Directory (createDirectoryIfMissing, doesDirectoryExist, doesFileExist) import System.Environment (lookupEnv)+import System.Info (os) import System.Process (readCreateProcessWithExitCode, shell) rules :: String@@ -73,13 +74,26 @@ -> FilePath -- ^ Manpage file name -> IO () writeManpages p p' = do+ mp' <- manPath+ case mp' of+ Just mp -> do+ createDirectoryIfMissing True mp+ writeFile (mp ++ "/" ++ p') =<< readFile p+ Nothing -> pure ()++manPathLinux :: IO (Maybe FilePath)+manPathLinux = do home <- lookupEnv "HOME" case home of- Just x -> do- let manPath = x ++ "/.local/share/man/man1"- createDirectoryIfMissing True manPath- writeFile (manPath ++ "/" ++ p') =<< readFile p -- FIXME: do nothing on windows- Nothing -> pure ()+ Just h -> pure $ Just (h ++ "/.local/share/man/man1")+ Nothing -> pure Nothing++manPath :: IO (Maybe FilePath)+manPath =+ case os of+ "linux" -> manPathLinux+ "osx" -> pure $ Just "/usr/local/share/man/man1"+ _ -> pure Nothing -- | Add a line to the user's @bashrc@ so that command-line completions work -- automatically.