Skip to content
Permalink
Browse files

Show help when no arguments are given

  • Loading branch information...
nmattia committed Oct 30, 2019
1 parent 1dd0941 commit 5ed7c608b4d55c963818f59f73fbbb501ab5dc63
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/Niv/Cli.hs
@@ -23,6 +23,7 @@ import Niv.Update
import System.Exit (ExitCode(ExitSuccess))
import System.FilePath ((</>), takeDirectory)
import System.Process (readProcessWithExitCode)
import System.Environment (getArgs)
import UnliftIO
import Data.Version (showVersion)
import qualified Data.Aeson as Aeson
@@ -41,9 +42,14 @@ import qualified System.Directory as Dir
import Paths_niv (version)

cli :: IO ()
cli = join $ Opts.execParser opts
cli = join $
execParserPure' Opts.defaultPrefs opts <$> getArgs
>>= Opts.handleParseResult
where
opts = Opts.info (parseCommand <**> Opts.helper) $ mconcat desc
execParserPure' pprefs pinfo [] = Opts.Failure $
Opts.parserFailure pprefs pinfo Opts.ShowHelpText mempty
execParserPure' pprefs pinfo args = Opts.execParserPure pprefs pinfo args
opts = Opts.info (parseCommand <**> Opts.helper ) $ mconcat desc
desc =
[ Opts.fullDesc
, Opts.headerDoc $ Just $

0 comments on commit 5ed7c60

Please sign in to comment.
You can’t perform that action at this time.