mirror of
https://github.com/nmattia/niv.git
synced 2024-12-01 15:56:03 +03:00
Merge pull request #135 from nmattia/nm-help-no-args
Show help when no arguments are given
This commit is contained in:
commit
88d6f20882
@ -23,6 +23,7 @@ import Niv.Update
|
|||||||
import System.Exit (ExitCode(ExitSuccess))
|
import System.Exit (ExitCode(ExitSuccess))
|
||||||
import System.FilePath ((</>), takeDirectory)
|
import System.FilePath ((</>), takeDirectory)
|
||||||
import System.Process (readProcessWithExitCode)
|
import System.Process (readProcessWithExitCode)
|
||||||
|
import System.Environment (getArgs)
|
||||||
import UnliftIO
|
import UnliftIO
|
||||||
import Data.Version (showVersion)
|
import Data.Version (showVersion)
|
||||||
import qualified Data.Aeson as Aeson
|
import qualified Data.Aeson as Aeson
|
||||||
@ -41,9 +42,14 @@ import qualified System.Directory as Dir
|
|||||||
import Paths_niv (version)
|
import Paths_niv (version)
|
||||||
|
|
||||||
cli :: IO ()
|
cli :: IO ()
|
||||||
cli = join $ Opts.execParser opts
|
cli = join $
|
||||||
|
execParserPure' Opts.defaultPrefs opts <$> getArgs
|
||||||
|
>>= Opts.handleParseResult
|
||||||
where
|
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 =
|
desc =
|
||||||
[ Opts.fullDesc
|
[ Opts.fullDesc
|
||||||
, Opts.headerDoc $ Just $
|
, Opts.headerDoc $ Just $
|
||||||
|
Loading…
Reference in New Issue
Block a user