hindent
parent
a3fa4e19cd
commit
2fd304394f
|
@ -1,4 +1,5 @@
|
|||
{ nixpkgs ? import <nixpkgs> { }, compiler ? "ghc865" }:
|
||||
(import ./release.nix { inherit compiler; }).elm-swapper.env.overrideAttrs (attrs: {
|
||||
buildInputs = attrs.buildInputs ++ [ nixpkgs.git nixpkgs.elmPackages.elm nixpkgs.cabal2nix nixpkgs.cabal-install ];
|
||||
buildInputs = attrs.buildInputs
|
||||
++ [ nixpkgs.git nixpkgs.elmPackages.elm nixpkgs.cabal2nix nixpkgs.cabal-install nixpkgs.haskellPackages.hindent ];
|
||||
})
|
||||
|
|
18
src/Main.hs
18
src/Main.hs
|
@ -4,23 +4,19 @@ import System.Directory
|
|||
import System.FilePath
|
||||
|
||||
nearestElmJson :: IO (Maybe FilePath)
|
||||
nearestElmJson =
|
||||
getCurrentDirectory >>= nearestElmJsonHelp
|
||||
nearestElmJson = getCurrentDirectory >>= nearestElmJsonHelp
|
||||
|
||||
nearestElmJsonHelp :: FilePath -> IO (Maybe FilePath)
|
||||
nearestElmJsonHelp filepath = do
|
||||
let candidate = filepath </> "elm.json"
|
||||
exists <- doesFileExist candidate
|
||||
if exists then
|
||||
pure $ Just candidate
|
||||
else
|
||||
let next = takeDirectory filepath in
|
||||
if exists
|
||||
then pure $ Just candidate
|
||||
else let next = takeDirectory filepath
|
||||
in if next == filepath
|
||||
then pure Nothing
|
||||
else nearestElmJsonHelp next
|
||||
|
||||
if next == filepath then
|
||||
pure Nothing
|
||||
else
|
||||
nearestElmJsonHelp next
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
elmJson <- nearestElmJson
|
||||
|
|
Loading…
Reference in New Issue