1
1
mirror of https://github.com/nmattia/niv.git synced 2024-10-06 12:27:35 +03:00

Update to optparse-applicative 0.18 (#389)

This commit is contained in:
Naïm Favier 2024-01-23 11:07:13 +01:00 committed by GitHub
parent b0ad17bce7
commit 290965abaa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 45 additions and 33 deletions

View File

@ -70,10 +70,12 @@ cli = do
[ Opts.fullDesc, [ Opts.fullDesc,
Opts.headerDoc $ Opts.headerDoc $
Just $ Just $
"niv - dependency manager for Nix projects" Opts.vcat
Opts.<$$> "" [ "niv - dependency manager for Nix projects",
Opts.<$$> "version:" "",
Opts.<+> Opts.text (showVersion version) "version:"
Opts.<+> Opts.pretty (showVersion version)
]
] ]
parseFindSourcesJson = parseFindSourcesJson =
AtPath AtPath
@ -420,10 +422,10 @@ parseCmdUpdate =
Opts.headerDoc $ Opts.headerDoc $
Just $ Just $
Opts.nest 2 $ Opts.nest 2 $
"Examples:" Opts.vcat
Opts.<$$> "" [ "Examples:",
Opts.<$$> Opts.vcat "",
[ Opts.fill 30 "niv update" Opts.<+> "# update all packages", Opts.fill 30 "niv update" Opts.<+> "# update all packages",
Opts.fill 30 "niv update nixpkgs" Opts.<+> "# update nixpkgs", Opts.fill 30 "niv update nixpkgs" Opts.<+> "# update nixpkgs",
Opts.fill 30 "niv update my-package -v beta-0.2" Opts.<+> "# update my-package to version \"beta-0.2\"" Opts.fill 30 "niv update my-package -v beta-0.2" Opts.<+> "# update my-package to version \"beta-0.2\""
] ]
@ -510,10 +512,12 @@ parseCmdModify =
Opts.progDesc "Modify dependency attributes without performing an update", Opts.progDesc "Modify dependency attributes without performing an update",
Opts.headerDoc $ Opts.headerDoc $
Just $ Just $
"Examples:" Opts.vcat
Opts.<$$> "" [ "Examples:",
Opts.<$$> " niv modify nixpkgs -v beta-0.2" "",
Opts.<$$> " niv modify nixpkgs -a branch=nixpkgs-unstable" " niv modify nixpkgs -v beta-0.2",
" niv modify nixpkgs -a branch=nixpkgs-unstable"
]
] ]
optName = optName =
Opts.optional $ Opts.optional $
@ -559,10 +563,12 @@ parseCmdDrop =
Opts.progDesc "Drop dependency", Opts.progDesc "Drop dependency",
Opts.headerDoc $ Opts.headerDoc $
Just $ Just $
"Examples:" Opts.vcat
Opts.<$$> "" [ "Examples:",
Opts.<$$> " niv drop jq" "",
Opts.<$$> " niv drop my-package version" " niv drop jq",
" niv drop my-package version"
]
] ]
parseDropAttributes :: Opts.Parser [T.Text] parseDropAttributes :: Opts.Parser [T.Text]
parseDropAttributes = parseDropAttributes =

View File

@ -133,12 +133,14 @@ describeGit =
Opts.progDesc "Add a git dependency. Experimental.", Opts.progDesc "Add a git dependency. Experimental.",
Opts.headerDoc $ Opts.headerDoc $
Just $ Just $
"Examples:" Opts.vcat
Opts.<$$> "" [ "Examples:",
Opts.<$$> " niv add git git@github.com:stedolan/jq" "",
Opts.<$$> " niv add git ssh://git@github.com/stedolan/jq --rev deadb33f" " niv add git git@github.com:stedolan/jq",
Opts.<$$> " niv add git https://github.com/stedolan/jq.git" " niv add git ssh://git@github.com/stedolan/jq --rev deadb33f",
Opts.<$$> " niv add git --repo /my/custom/repo --name custom --branch development" " niv add git https://github.com/stedolan/jq.git",
" niv add git --repo /my/custom/repo --name custom --branch development"
]
] ]
gitUpdate :: gitUpdate ::

View File

@ -127,11 +127,13 @@ describeGitHub =
Opts.progDesc "Add a GitHub dependency", Opts.progDesc "Add a GitHub dependency",
Opts.headerDoc $ Opts.headerDoc $
Just $ Just $
"Examples:" Opts.vcat
Opts.<$$> "" [ "Examples:",
Opts.<$$> " niv add stedolan/jq" "",
Opts.<$$> " niv add NixOS/nixpkgs -n nixpkgs -b nixpkgs-unstable" " niv add stedolan/jq",
Opts.<$$> " niv add my-package -v alpha-0.1 -t http://example.com/archive/<version>.zip" " niv add NixOS/nixpkgs -n nixpkgs -b nixpkgs-unstable",
" niv add my-package -v alpha-0.1 -t http://example.com/archive/<version>.zip"
]
] ]
-- parse a github shortcut of the form "owner/repo" -- parse a github shortcut of the form "owner/repo"

View File

@ -59,7 +59,9 @@ describeLocal =
Opts.progDesc "Add a local dependency. Experimental.", Opts.progDesc "Add a local dependency. Experimental.",
Opts.headerDoc $ Opts.headerDoc $
Just $ Just $
"Examples:" Opts.vcat
Opts.<$$> "" [ "Examples:",
Opts.<$$> " niv add local ./foo/bar" "",
" niv add local ./foo/bar"
]
] ]