ethereum-analyzer-cli 2.0.0 → 2.0.1
raw patch · 2 files changed
+13/−9 lines, 2 files
Files
- ethereum-analyzer-cli.cabal +2/−2
- exec_src/AnalyzeMain.hs +11/−7
ethereum-analyzer-cli.cabal view
@@ -1,5 +1,5 @@ name: ethereum-analyzer-cli-version: 2.0.0+version: 2.0.1 synopsis: A CLI frontend for ethereum-analyzer. homepage: https://github.com/ethereumK/ethereum-analyzer license: Apache-2.0@@ -21,7 +21,7 @@ source-repository this type: git location: https://github.com/zchn/ethereum-analyzer- tag: v2.0.0+ tag: v2.0.1 subdir: ethereum-analyzer-cli library
exec_src/AnalyzeMain.hs view
@@ -7,7 +7,7 @@ import qualified Data.Text as T import Ethereum.Analyzer.Debug-import Ethereum.Analyzer.Solidity+import Ethereum.Analyzer.Solidity hiding (value) import Options.Applicative import Options.Applicative.Text@@ -21,7 +21,8 @@ analyzeFlags = AnalyzeFlags <$> textOption- (long "astJson" <> metavar "PATH" <> help "Path to the ast-json file.") <*>+ (long "astJson" <> value "" <> metavar "PATH" <>+ help "Path to the ast-json file.") <*> switch (long "debug" <> help "Whether to print debug info") main :: IO ()@@ -36,13 +37,16 @@ (toS ("ea-analyze - CLI interface for ethereum-analyzer" :: Text))) analyze :: AnalyzeFlags -> IO ()-analyze flags@AnalyzeFlags {astJson = theAstJson} = do- putText $ show flags- content <- readFile $ toS theAstJson+analyze flags@AnalyzeFlags {astJson = theAstJson, debug = debug} = do+ when debug $ putText $ show flags+ content <-+ if (theAstJson == "" || theAstJson == "-")+ then getContents+ else readFile $ toS theAstJson case decodeContracts content of Right contracts -> do- pprintContracts contracts- putText "Findins: \n"+ when debug $ pprintContracts contracts+ putText "Findings: \n" putText ("\n" `T.intercalate` concatMap findingsFor contracts) Left err -> putText err return ()