ast-grep: ast-grep: rename command sg to ast-grep
This commit is contained in:
@@ -115,6 +115,8 @@
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
- `ast-grep` remove `sg` command to prevent conflict with `sg` command from shadow-utils. If you need legacy sg command compatibility with old code, you can use `ast-grep.override { enableLegacySg = true; }`
|
||||
|
||||
- `binwalk` was updated to 3.1.0, which has been rewritten in rust. The python module is no longer available.
|
||||
See the release notes of [3.1.0](https://github.com/ReFirmLabs/binwalk/releases/tag/v3.1.0) for more information.
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
fetchFromGitHub,
|
||||
stdenv,
|
||||
installShellFiles,
|
||||
buildPackages,
|
||||
versionCheckHook,
|
||||
enableLegacySg ? false,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
@@ -26,12 +29,27 @@ rustPlatform.buildRustPackage rec {
|
||||
rm .cargo/config.toml
|
||||
'';
|
||||
|
||||
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
installShellCompletion --cmd sg \
|
||||
--bash <($out/bin/sg completions bash) \
|
||||
--fish <($out/bin/sg completions fish) \
|
||||
--zsh <($out/bin/sg completions zsh)
|
||||
'';
|
||||
cargoBuildFlags = [
|
||||
"--package ast-grep --bin ast-grep"
|
||||
] ++ lib.optionals enableLegacySg [ "--package ast-grep --bin sg" ];
|
||||
|
||||
postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
|
||||
let
|
||||
emulator = stdenv.hostPlatform.emulator buildPackages;
|
||||
in
|
||||
''
|
||||
installShellCompletion --cmd ast-grep \
|
||||
--bash <(${emulator} $out/bin/ast-grep completions bash) \
|
||||
--fish <(${emulator} $out/bin/ast-grep completions fish) \
|
||||
--zsh <(${emulator} $out/bin/ast-grep completions zsh)
|
||||
''
|
||||
+ lib.optionalString enableLegacySg ''
|
||||
installShellCompletion --cmd sg \
|
||||
--bash <(${emulator} $out/bin/sg completions bash) \
|
||||
--fish <(${emulator} $out/bin/sg completions fish) \
|
||||
--zsh <(${emulator} $out/bin/sg completions zsh)
|
||||
''
|
||||
);
|
||||
|
||||
checkFlags =
|
||||
[
|
||||
@@ -48,9 +66,14 @@ rustPlatform.buildRustPackage rec {
|
||||
"--skip=test::test_load_parser"
|
||||
"--skip=test::test_register_lang"
|
||||
];
|
||||
nativeInstallCheckInputs = [
|
||||
versionCheckHook
|
||||
];
|
||||
versionCheckProgramArg = [ "--version" ];
|
||||
doInstallCheck = true;
|
||||
|
||||
meta = with lib; {
|
||||
mainProgram = "sg";
|
||||
mainProgram = "ast-grep";
|
||||
description = "Fast and polyglot tool for code searching, linting, rewriting at large scale";
|
||||
homepage = "https://ast-grep.github.io/";
|
||||
changelog = "https://github.com/ast-grep/ast-grep/blob/${src.rev}/CHANGELOG.md";
|
||||
|
||||
Reference in New Issue
Block a user