This repository was archived by the owner on Jan 22, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvulns.rb
More file actions
50 lines (43 loc) · 1.41 KB
/
vulns.rb
File metadata and controls
50 lines (43 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# frozen_string_literal: true
require_relative "vulns/base"
require_relative "vulns/scan"
require_relative "vulns/sync"
require_relative "vulns/blame"
require_relative "vulns/praise"
require_relative "vulns/exposure"
require_relative "vulns/diff"
require_relative "vulns/log"
require_relative "vulns/history"
require_relative "vulns/show"
module Git
module Pkgs
module Commands
class VulnsCommand
SUBCOMMANDS = %w[sync blame praise exposure diff log history show].freeze
def initialize(args)
@args = args.dup
@subcommand = detect_subcommand
end
def detect_subcommand
return nil if @args.empty?
return nil unless SUBCOMMANDS.include?(@args.first)
@args.shift
end
def run
handler_class = case @subcommand
when "sync" then Vulns::Sync
when "blame" then Vulns::Blame
when "praise" then Vulns::Praise
when "exposure" then Vulns::Exposure
when "diff" then Vulns::Diff
when "log" then Vulns::Log
when "history" then Vulns::History
when "show" then Vulns::Show
else Vulns::Scan
end
handler_class.new(@args).run
end
end
end
end
end