Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 274f618

Browse files
committed
Add command aliases support in CLI for improved usability
1 parent 30379a1 commit 274f618

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- `git pkgs history` now supports `--author`, `--since`, and `--until` filters
88
- `git pkgs stats --by-author` shows who added the most dependencies
99
- `git pkgs stats --ecosystem=X` filters statistics by ecosystem
10+
- `git pkgs praise` alias for `blame`
1011

1112
## [0.1.1] - 2026-01-01
1213

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Show who added each current dependency:
146146
```bash
147147
git pkgs blame
148148
git pkgs blame --ecosystem=rubygems
149+
git pkgs praise # alias for blame
149150
```
150151

151152
Example output:

lib/git/pkgs/cli.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module Git
66
module Pkgs
77
class CLI
88
COMMANDS = %w[init update hooks info list tree history search why blame outdated stats diff branch show log].freeze
9+
ALIASES = { "praise" => "blame" }.freeze
910

1011
def self.run(args)
1112
new(args).run
@@ -24,7 +25,7 @@ def run
2425
print_help
2526
when "-v", "--version", "version"
2627
puts "git-pkgs #{Git::Pkgs::VERSION}"
27-
when *COMMANDS
28+
when *COMMANDS, *ALIASES.keys
2829
run_command(command)
2930
else
3031
$stderr.puts "Unknown command: #{command}"
@@ -34,6 +35,7 @@ def run
3435
end
3536

3637
def run_command(command)
38+
command = ALIASES.fetch(command, command)
3739
command_class = Commands.const_get(command.capitalize.gsub(/_([a-z])/) { $1.upcase })
3840
command_class.new(@args).run
3941
rescue NameError

0 commit comments

Comments
 (0)