From 7e96e82cad1f8d7a99a4e61b0a366b2097c7aabc Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Fri, 25 Feb 2022 02:04:08 -0800 Subject: [bun pm] add help menu --- src/cli/package_manager_command.zig | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/cli/package_manager_command.zig') diff --git a/src/cli/package_manager_command.zig b/src/cli/package_manager_command.zig index 80d12125d..cd330493c 100644 --- a/src/cli/package_manager_command.zig +++ b/src/cli/package_manager_command.zig @@ -46,15 +46,13 @@ pub const PackageManagerCommand = struct { var first: []const u8 = if (pm.options.positionals.len > 0) pm.options.positionals[0] else ""; if (strings.eqlComptime(first, "pm")) { + first = ""; if (pm.options.positionals.len > 1) { pm.options.positionals = pm.options.positionals[1..]; - } else { - return; + first = pm.options.positionals[0]; } } - first = pm.options.positionals[0]; - if (pm.options.global) { try pm.setupGlobalDir(&ctx); } @@ -142,5 +140,25 @@ pub const PackageManagerCommand = struct { _ = try pm.lockfile.hasMetaHashChanged(true); Global.exit(0); } + + Output.prettyln( + \\bun pm - package manager related commands + \\ + \\ bun pm bin print the path to bin folder + \\ bun pm -g bin print the global path to bin folder + \\ bun pm hash generate & print the hash of the current lockfile + \\ bun pm hash-string print the string used to hash the lockfile + \\ bun pm hash-print print the hash stored in the current lockfile + \\ + , .{}); + + if (first.len > 0) { + Output.prettyErrorln("\nerror: \"{s}\" unknown command\n", .{first}); + Output.flush(); + + Global.exit(1); + } else { + Global.exit(0); + } } }; -- cgit v1.2.3