Class: GitJump::Actions::Status

Inherits:
Base
  • Object
show all
Defined in:
lib/git_jump/actions/status.rb

Overview

Action to display current status and configuration

Instance Attribute Summary

Attributes inherited from Base

#config, #database, #output, #repository

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from GitJump::Actions::Base

Instance Method Details

#executeObject



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
# File 'lib/git_jump/actions/status.rb', line 9

def execute
  output.heading("Git Jump Status")

  output.info("Project: #{repository.project_basename}")
  output.info("Path: #{repository.project_path}")
  output.info("Current branch: #{repository.current_branch || "(none)"}")

  output.heading("Configuration")
  output.info("Config file: #{config.path}")
  output.info("Config exists: #{config.exists? ? "Yes" : "No"}")
  output.info("Database: #{config.database_path}")
  output.info("Max branches: #{config.max_branches}")
  output.info("Auto-track: #{config.auto_track? ? "Enabled" : "Disabled"}")
  output.info("Keep patterns: #{config.keep_patterns.join(", ")}")

  output.heading("Hook Status")
  hook_installed = repository.hook_installed?("post-checkout")
  output.info("Post-checkout hook: #{hook_installed ? "Installed" : "Not installed"}")

  output.heading("Tracking Statistics")
  stats = database.project_stats(project_id)
  output.info("Total branches tracked: #{stats[:total_branches]}")

  output.info("Most recent: #{stats[:most_recent]["name"]}") if stats[:most_recent]

  true
end