diff --git a/README.md b/README.md index 67f8dda..e18f6ee 100644 --- a/README.md +++ b/README.md @@ -43,12 +43,13 @@ necessary for fetching and updating the packages. * [Update](#update): updates one or all packages in `nix/sources.json`. * [Drop](#drop): deletes a package from `nix/sources.json`. -`niv` has two more utility functions: +`niv` has some utility functions: * [Init](#init): bootstraps a Nix project, in particular creates a `nix/sources.json` file containing `niv` and `nixpkgs` as well as a `nix/sources.nix` file that returns the sources as a Nix object. * [Show](#show): shows the packages' information. +* [Modify](#modify): modifies attributes _without_ performing an update. ### Configuration @@ -217,7 +218,8 @@ Available commands: add Add a GitHub dependency show update Update dependencies - modify Modify dependency + modify Modify dependency attributes without performing an + update drop Drop dependency ``` @@ -293,6 +295,38 @@ Available options: ``` +#### Modify + +``` +Examples: + + niv modify nixpkgs -v beta-0.2 + niv modify nixpkgs -a branch=nixpkgs-unstable + +Usage: niv modify PACKAGE ([-a|--attribute KEY=VAL] | + [-s|--string-attribute KEY=VAL] | [-b|--branch BRANCH] | + [-o|--owner OWNER] | [-r|--repo REPO] | [-v|--version VERSION] + | [-t|--template URL] | [-T|--type TYPE]) + Modify dependency attributes without performing an update + +Available options: + -a,--attribute KEY=VAL Set the package spec attribute to , where + may be JSON. + -s,--string-attribute KEY=VAL + Set the package spec attribute to . + -b,--branch BRANCH Equivalent to --attribute branch= + -o,--owner OWNER Equivalent to --attribute owner= + -r,--repo REPO Equivalent to --attribute repo= + -v,--version VERSION Equivalent to --attribute version= + -t,--template URL Used during 'update' when building URL. Occurrences + of are replaced with attribute 'foo'. + -T,--type TYPE The type of the URL target. The value can be either + 'file' or 'tarball'. If not set, the value is + inferred from the suffix of the URL. + -h,--help Show this help text + +``` + #### Drop ``` diff --git a/README.tpl.md b/README.tpl.md index b99d3da..08643df 100644 --- a/README.tpl.md +++ b/README.tpl.md @@ -43,12 +43,13 @@ necessary for fetching and updating the packages. * [Update](#update): updates one or all packages in `nix/sources.json`. * [Drop](#drop): deletes a package from `nix/sources.json`. -`niv` has two more utility functions: +`niv` has some utility functions: * [Init](#init): bootstraps a Nix project, in particular creates a `nix/sources.json` file containing `niv` and `nixpkgs` as well as a `nix/sources.nix` file that returns the sources as a Nix object. * [Show](#show): shows the packages' information. +* [Modify](#modify): modifies attributes _without_ performing an update. ### Configuration @@ -216,6 +217,12 @@ replace_niv_add_help replace_niv_update_help ``` +#### Modify + +``` +replace_niv_modify_help +``` + #### Drop ``` diff --git a/default.nix b/default.nix index 9031a35..e1a4e45 100644 --- a/default.nix +++ b/default.nix @@ -210,7 +210,7 @@ rec pkgs.runCommand "niv_${cmd}_help" { buildInputs = [ niv ]; } "niv ${cmd} --help > $out" ); - cmds = [ "add" "update" "drop" "init" "show" ]; + cmds = [ "add" "update" "modify" "drop" "init" "show" ]; in pkgs.lib.replaceStrings ([ "replace_niv_help" ] ++ (map (cmd: "replace_niv_${cmd}_help") cmds)) diff --git a/src/Niv/Cli.hs b/src/Niv/Cli.hs index aa1aeeb..f13257d 100644 --- a/src/Niv/Cli.hs +++ b/src/Niv/Cli.hs @@ -399,7 +399,7 @@ parseCmdModify = where desc = [ Opts.fullDesc - , Opts.progDesc "Modify dependency" + , Opts.progDesc "Modify dependency attributes without performing an update" , Opts.headerDoc $ Just $ "Examples:" Opts.<$$> "" Opts.<$$>