a0cb138ada
GitOrigin-RevId: a100acd7bbf105915b0004427802286c37738fef
48 lines
1.4 KiB
Nix
48 lines
1.4 KiB
Nix
{ lib
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "dasel";
|
|
version = "2.1.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "TomWright";
|
|
repo = "dasel";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-27tQEWnirDhqYt5smRFwADa9wKXSk6yXR8+mXvJVtYI=";
|
|
};
|
|
|
|
vendorHash = "sha256-GO5Vg8zsXfjMBzRDC1/s/SYpviKUf59JB14vauKVFcE=";
|
|
|
|
ldflags = [
|
|
"-s" "-w" "-X github.com/tomwright/dasel/v2/internal.Version=${version}"
|
|
];
|
|
|
|
doInstallCheck = true;
|
|
installCheckPhase = ''
|
|
runHook preInstallCheck
|
|
if [[ $($out/bin/dasel --version) == "dasel version ${version}" ]]; then
|
|
echo '{ "my": { "favourites": { "colour": "blue" } } }' \
|
|
| $out/bin/dasel put -t json -r json -t string -v "red" "my.favourites.colour" \
|
|
| grep "red"
|
|
else
|
|
return 1
|
|
fi
|
|
runHook postInstallCheck
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Query and update data structures from the command line";
|
|
longDescription = ''
|
|
Dasel (short for data-selector) allows you to query and modify data structures using selector strings.
|
|
Comparable to jq / yq, but supports JSON, YAML, TOML and XML with zero runtime dependencies.
|
|
'';
|
|
homepage = "https://github.com/TomWright/dasel";
|
|
changelog = "https://github.com/TomWright/dasel/blob/v${version}/CHANGELOG.md";
|
|
license = licenses.mit;
|
|
platforms = platforms.unix;
|
|
maintainers = with maintainers; [ _0x4A6F ];
|
|
};
|
|
}
|