mirror of
https://github.com/Mic92/nix-update.git
synced 2024-11-03 21:04:49 +03:00
Add --format flag
The flag will invoke nixpkgs-fmt
This commit is contained in:
parent
6263b42c26
commit
76cf63bbe2
@ -98,6 +98,8 @@ tested.
|
||||
Additionally, the `--review` flag can be used to initiate a run of
|
||||
nixpkgs-review <https://github.com/Mic92/nixpkgs-review>, which will ensure all
|
||||
dependent packages can be built.
|
||||
In order to ensure consistent formatting, the `--format` flag will invoke
|
||||
[nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt).
|
||||
|
||||
|
||||
::
|
||||
@ -112,6 +114,8 @@ dependent packages can be built.
|
||||
$ nix-update --run nixpkgs-review
|
||||
# Run `nixpkgs-review wip` to validate dependent packages
|
||||
$ nix-update --review nixpkgs-review
|
||||
# Format file
|
||||
$ nix-update --format nixpkgs-review
|
||||
|
||||
Nix-update also can optionally generate a commit message in the form
|
||||
`attribute: old_version -> new_version` with the applied version update:
|
||||
|
@ -27,7 +27,7 @@ python3.pkgs.buildPythonApplication rec {
|
||||
mypy --strict nix_update
|
||||
'';
|
||||
makeWrapperArgs = [
|
||||
"--prefix PATH" ":" (lib.makeBinPath [ nixFlakes nix-prefetch nixpkgs-review ])
|
||||
"--prefix PATH" ":" (lib.makeBinPath [ nixFlakes nix-prefetch nixpkgs-fmt nixpkgs-review ])
|
||||
];
|
||||
shellHook = ''
|
||||
# workaround because `python setup.py develop` breaks for me
|
||||
|
@ -26,6 +26,7 @@ def parse_args() -> Options:
|
||||
parser.add_argument(
|
||||
"--review", action="store_true", help="Run `nixpkgs-review wip`"
|
||||
)
|
||||
parser.add_argument("--format", action="store_true", help="Run `nixpkgs-fmt`")
|
||||
parser.add_argument(
|
||||
"--commit", action="store_true", help="Commit the updated package"
|
||||
)
|
||||
@ -59,6 +60,7 @@ def parse_args() -> Options:
|
||||
test=args.test,
|
||||
version_regex=args.version_regex,
|
||||
review=args.review,
|
||||
format=args.format,
|
||||
)
|
||||
|
||||
|
||||
@ -173,6 +175,11 @@ def nixpkgs_review() -> None:
|
||||
run(cmd, check=True)
|
||||
|
||||
|
||||
def nixpkgs_fmt(package: Package) -> None:
|
||||
cmd = ["nixpkgs-fmt", package.filename]
|
||||
run(cmd, check=True)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
options = parse_args()
|
||||
if not os.path.exists(options.import_path):
|
||||
@ -208,6 +215,9 @@ def main() -> None:
|
||||
if options.review:
|
||||
nixpkgs_review()
|
||||
|
||||
if options.format:
|
||||
nixpkgs_fmt(package)
|
||||
|
||||
if options.commit:
|
||||
assert git_dir is not None
|
||||
git_commit(git_dir, options.attribute, package)
|
||||
|
@ -13,3 +13,4 @@ class Options:
|
||||
build: bool = False
|
||||
test: bool = False
|
||||
review: bool = False
|
||||
format: bool = False
|
||||
|
Loading…
Reference in New Issue
Block a user