mirror of
https://github.com/nmattia/niv.git
synced 2024-11-07 22:36:53 +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:
|
Available options:
|
||||||
-s,--sources-file FILE Use FILE instead of nix/sources.json
|
-s,--sources-file FILE Use FILE instead of nix/sources.json
|
||||||
-h,--help Show this help text
|
-h,--help Show this help text
|
||||||
|
--version Print version
|
||||||
|
|
||||||
Available commands:
|
Available commands:
|
||||||
init Initialize a Nix project. Existing files won't be
|
init Initialize a Nix project. Existing files won't be
|
||||||
|
@ -153,9 +153,7 @@ let
|
|||||||
packages = ps: [ ps.niv ];
|
packages = ps: [ ps.niv ];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
repl_for() {
|
repl_for() {
|
||||||
haskell_version=$(cat ./package.yaml \
|
haskell_version=$(jq <./package.yaml -cMr '.version' | sed 's/\./,/g')
|
||||||
| grep -oP 'version: \K\d+.\d+.\d+' \
|
|
||||||
| sed 's/\./,/g' )
|
|
||||||
|
|
||||||
paths_niv=$(mktemp -d)/Paths_niv.hs
|
paths_niv=$(mktemp -d)/Paths_niv.hs
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ cli = do
|
|||||||
Opts.Failure $
|
Opts.Failure $
|
||||||
Opts.parserFailure pprefs pinfo Opts.ShowHelpText mempty
|
Opts.parserFailure pprefs pinfo Opts.ShowHelpText mempty
|
||||||
execParserPure' pprefs pinfo args = Opts.execParserPure pprefs pinfo args
|
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 =
|
desc =
|
||||||
[ Opts.fullDesc,
|
[ Opts.fullDesc,
|
||||||
Opts.headerDoc $ Just $
|
Opts.headerDoc $ Just $
|
||||||
@ -78,6 +78,11 @@ cli = do
|
|||||||
<> Opts.help "Use FILE instead of nix/sources.json"
|
<> Opts.help "Use FILE instead of nix/sources.json"
|
||||||
)
|
)
|
||||||
<|> pure Auto
|
<|> 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 :: Opts.Parser (NIO ())
|
||||||
parseCommand =
|
parseCommand =
|
||||||
|
Loading…
Reference in New Issue
Block a user