mirror of
https://github.com/nmattia/niv.git
synced 2024-09-05 20:15:26 +03:00
Show version with --version
This commit is contained in:
parent
6ae4c7700b
commit
b50a010769
@ -223,6 +223,7 @@ Usage: niv [-s|--sources-file FILE] COMMAND
|
||||
Available options:
|
||||
-s,--sources-file FILE Use FILE instead of nix/sources.json
|
||||
-h,--help Show this help text
|
||||
--version Print version
|
||||
|
||||
Available commands:
|
||||
init Initialize a Nix project. Existing files won't be
|
||||
|
@ -153,9 +153,7 @@ let
|
||||
packages = ps: [ ps.niv ];
|
||||
shellHook = ''
|
||||
repl_for() {
|
||||
haskell_version=$(cat ./package.yaml \
|
||||
| grep -oP 'version: \K\d+.\d+.\d+' \
|
||||
| sed 's/\./,/g' )
|
||||
haskell_version=$(jq <./package.yaml -cMr '.version' | sed 's/\./,/g')
|
||||
|
||||
paths_niv=$(mktemp -d)/Paths_niv.hs
|
||||
|
||||
|
@ -61,7 +61,7 @@ cli = do
|
||||
Opts.Failure $
|
||||
Opts.parserFailure pprefs pinfo Opts.ShowHelpText mempty
|
||||
execParserPure' pprefs pinfo args = Opts.execParserPure pprefs pinfo args
|
||||
opts = Opts.info ((,) <$> parseFindSourcesJson <*> (parseCommand <**> Opts.helper)) $ mconcat desc
|
||||
opts = Opts.info ((,) <$> parseFindSourcesJson <*> (parseCommand <**> Opts.helper <**> versionflag)) $ mconcat desc
|
||||
desc =
|
||||
[ Opts.fullDesc,
|
||||
Opts.headerDoc $ Just $
|
||||
@ -78,6 +78,11 @@ cli = do
|
||||
<> Opts.help "Use FILE instead of nix/sources.json"
|
||||
)
|
||||
<|> pure Auto
|
||||
versionflag :: Opts.Parser (a -> a)
|
||||
versionflag =
|
||||
Opts.abortOption (Opts.InfoMsg (showVersion version)) $
|
||||
mconcat
|
||||
[Opts.long "version", Opts.hidden, Opts.help "Print version"]
|
||||
|
||||
parseCommand :: Opts.Parser (NIO ())
|
||||
parseCommand =
|
||||
|
Loading…
Reference in New Issue
Block a user