1. Stefan Saasen
  2. stash-log-parser

Commits

Stefan Saasen  committed d1ec96e

If no arguments are given, the logparse shows the help output by default.

Hat tip to Shinobu who documented this on
http://zuttobenkyou.wordpress.com/2011/04/19/haskell-using-cmdargs-single-and-multi-mode/

  • Participants
  • Parent commits 2e09f40
  • Branches master

Comments (0)

Files changed (1)

File logparser/src/Main.hs

View file
 {-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}
 module Main where
 
+import System.Environment (getArgs, withArgs)
 import Stash.Log.Analyser hiding (ProtocolStats)
 import Stash.Log.GitOpsAnalyser
 import Stash.Log.Output
 
 main :: IO ()
 main = do
-    config <- cmdArgsRun mode
+    options <- getArgs
+    -- We need arguments so if there are no arguments given, invoke the help command
+    config <- (if null options then withArgs ["--help"] else id) $ cmdArgsRun mode
     run config