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

View File

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

View File

@ -127,11 +127,13 @@ describeGitHub =
Opts.progDesc "Add a GitHub dependency",
Opts.headerDoc $
Just $
"Examples:"
Opts.<$$> ""
Opts.<$$> " niv add stedolan/jq"
Opts.<$$> " niv add NixOS/nixpkgs -n nixpkgs -b nixpkgs-unstable"
Opts.<$$> " niv add my-package -v alpha-0.1 -t http://example.com/archive/<version>.zip"
Opts.vcat
[ "Examples:",
"",
" niv add stedolan/jq",
" 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"

View File

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