Class: Kscript::KkProjectScanUtils

Inherits:
Base
  • Object
show all
Defined in:
lib/kscript/plugins/kk_project_scan_utils.rb

Instance Attribute Summary

Attributes inherited from Base

#logger

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#human_output?, inherited, #with_error_handling

Constructor Details

#initialize(*args, **opts) ⇒ KkProjectScanUtils

Returns a new instance of KkProjectScanUtils.



12
13
14
# File 'lib/kscript/plugins/kk_project_scan_utils.rb', line 12

def initialize(*args, **opts)
  super
end

Class Method Details

.argumentsObject



33
34
35
# File 'lib/kscript/plugins/kk_project_scan_utils.rb', line 33

def self.arguments
  '[src_path]'
end

.authorObject



45
46
47
# File 'lib/kscript/plugins/kk_project_scan_utils.rb', line 45

def self.author
  'kk'
end

.descriptionObject



29
30
31
# File 'lib/kscript/plugins/kk_project_scan_utils.rb', line 29

def self.description
  'Scan and list all git projects in a directory.'
end

.groupObject



41
42
43
# File 'lib/kscript/plugins/kk_project_scan_utils.rb', line 41

def self.group
  'project'
end

.usageObject



37
38
39
# File 'lib/kscript/plugins/kk_project_scan_utils.rb', line 37

def self.usage
  "kscript project_scan ~/projects/src\nkscript project_scan /opt --type=go"
end

Instance Method Details

#run(*args, **_opts) ⇒ Object



16
17
18
19
20
21
# File 'lib/kscript/plugins/kk_project_scan_utils.rb', line 16

def run(*args, **_opts)
  with_error_handling do
    @src_path = args[0] || @src_path || Dir.pwd
    scan_and_display
  end
end

#scan_and_displayObject



23
24
25
26
27
# File 'lib/kscript/plugins/kk_project_scan_utils.rb', line 23

def scan_and_display
  ensure_directory_exists
  projects = scan_projects
  display_projects(projects)
end