Add --catalog flag to bun install command

The --catalog flag was previously only available on `bun add`.
This change makes it also available on `bun install` so users
can run `bun install --catalog react` to add a package with
a catalog reference.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2025-12-16 03:51:39 +00:00
parent e06141bbdc
commit 4aa2fb3573

View File

@@ -65,6 +65,7 @@ pub const install_params: []const ParamType = &(shared_params ++ [_]ParamType{
clap.parseParam("--filter <STR>... Install packages for the matching workspaces") catch unreachable,
clap.parseParam("-a, --analyze Analyze & install all dependencies of files passed as arguments recursively (using Bun's bundler)") catch unreachable,
clap.parseParam("--only-missing Only add dependencies to package.json if they are not already present") catch unreachable,
clap.parseParam("--catalog <STR>? Use catalog for version (optionally specify catalog name)") catch unreachable,
clap.parseParam("<POS> ... ") catch unreachable,
});
@@ -1031,7 +1032,7 @@ pub fn parse(allocator: std.mem.Allocator, comptime subcommand: Subcommand) !Com
cli.exact = args.flag("--exact");
cli.analyze = args.flag("--analyze");
cli.only_missing = args.flag("--only-missing");
if (comptime subcommand == .add) {
if (comptime subcommand == .add or subcommand == .install) {
cli.catalog_name = args.option("--catalog");
}
}