2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2020-11-06 00:33:48 +00:00
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "dasel";
|
2023-01-20 10:41:00 +00:00
|
|
|
version = "2.1.0";
|
2020-11-06 00:33:48 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "TomWright";
|
2021-12-06 16:07:01 +00:00
|
|
|
repo = "dasel";
|
2020-11-06 00:33:48 +00:00
|
|
|
rev = "v${version}";
|
2023-01-20 10:41:00 +00:00
|
|
|
sha256 = "sha256-7JGafJE9nwZ95bOWUyVw2uWA2LltE9HxolHGYU079to=";
|
2020-11-06 00:33:48 +00:00
|
|
|
};
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
vendorHash = "sha256-GO5Vg8zsXfjMBzRDC1/s/SYpviKUf59JB14vauKVFcE=";
|
2020-11-06 00:33:48 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s" "-w" "-X github.com/tomwright/dasel/internal.Version=${version}"
|
|
|
|
];
|
2020-12-07 07:45:13 +00:00
|
|
|
|
2020-12-29 15:07:52 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
2022-12-17 10:02:37 +00:00
|
|
|
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"
|
2020-12-29 15:07:52 +00:00
|
|
|
else
|
|
|
|
return 1
|
|
|
|
fi
|
2022-12-17 10:02:37 +00:00
|
|
|
runHook postInstallCheck
|
2020-12-29 15:07:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-11-06 00:33:48 +00:00
|
|
|
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";
|
2021-12-06 16:07:01 +00:00
|
|
|
changelog = "https://github.com/TomWright/dasel/blob/v${version}/CHANGELOG.md";
|
2020-11-06 00:33:48 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ _0x4A6F ];
|
|
|
|
};
|
|
|
|
}
|