-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option for version_key #214
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -18,7 +18,9 @@ def die(msg: str) -> NoReturn: | |||||
|
||||||
|
||||||
def parse_args(args: list[str]) -> Options: | ||||||
parser = argparse.ArgumentParser() | ||||||
parser = argparse.ArgumentParser( | ||||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter | ||||||
) | ||||||
help = "File to import rather than default.nix. Examples, ./release.nix" | ||||||
parser.add_argument("-f", "--file", default="./.", help=help) | ||||||
parser.add_argument( | ||||||
|
@@ -56,6 +58,12 @@ def parse_args(args: list[str]) -> Options: | |||||
help="Regex to extract version with, i.e. 'jq-(.*)'", | ||||||
default="(.*)", | ||||||
) | ||||||
parser.add_argument( | ||||||
"-vk", | ||||||
"--version-key", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think version-attr fits better with how nix language names things:
Suggested change
|
||||||
help="Key of attribute that holds the version", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
default="version", | ||||||
) | ||||||
parser.add_argument( | ||||||
"--run", | ||||||
action="store_true", | ||||||
|
@@ -107,6 +115,7 @@ def parse_args(args: list[str]) -> Options: | |||||
attribute=a.attribute, | ||||||
test=a.test, | ||||||
version_regex=a.version_regex, | ||||||
version_key=a.version_key, | ||||||
review=a.review, | ||||||
format=a.format, | ||||||
override_filename=a.override_filename, | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import subprocess | ||
|
||
import conftest | ||
|
||
from nix_update.options import Options | ||
from nix_update.update import update | ||
|
||
|
||
def test_update(helpers: conftest.Helpers) -> None: | ||
with helpers.testpkgs() as path: | ||
opts = Options( | ||
attribute="versionkey", import_path=str(path), version_key="immich_version" | ||
) | ||
update(opts) | ||
version = subprocess.run( | ||
[ | ||
"nix", | ||
"eval", | ||
"--raw", | ||
"--extra-experimental-features", | ||
"nix-command", | ||
"-f", | ||
path, | ||
"versionkey.immich_version", | ||
], | ||
text=True, | ||
stdout=subprocess.PIPE, | ||
).stdout.strip() | ||
assert tuple(map(int, version.split("."))) >= (1, 91, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ buildNpmPackage | ||
, fetchFromGitHub | ||
}: | ||
buildNpmPackage rec { | ||
pname = "immich-cli"; | ||
# version of immich and immich cli differes | ||
version = (builtins.fromJSON (builtins.readFile "${src}/cli/package.json")).version; | ||
|
||
immich_version = "1.91.0"; | ||
src = fetchFromGitHub { | ||
owner = "immich-app"; | ||
repo = "immich"; | ||
rev = "v${immich_version}"; | ||
hash = "sha256-tFaa2rN4iGMlrPjHqSbMOE2xbyJh7Ro+Fm8j0+wa1MM="; | ||
}; | ||
|
||
npmDepsHash = "sha256-NvU+v8MrwPK6q8RdVEHhzi5g6qRRmdTtInf7o2E5y6Y="; | ||
|
||
postPatch = '' | ||
cd cli | ||
''; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we need a short-hand for that:
I see this more being used in scripts where the long-form is more descriptive.