Class: Lutaml::Cli::InteractiveShell::HelpDisplay

Inherits:
CommandBase
  • Object
show all
Defined in:
lib/lutaml/cli/interactive_shell/help_display.rb

Instance Attribute Summary

Attributes inherited from CommandBase

#shell

Instance Method Summary collapse

Methods inherited from CommandBase

#bookmarks, #config, #current_path, #current_path=, #initialize, #last_results, #last_results=, #path_history, #repository

Constructor Details

This class inherits a constructor from Lutaml::Cli::InteractiveShell::CommandBase

Instance Method Details

#cmd_clear(_args) ⇒ Object



46
47
48
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 46

def cmd_clear(_args)
  print "\e[2J\e[H"
end

#cmd_config(_args) ⇒ Object



50
51
52
53
54
55
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 50

def cmd_config(_args)
  puts OutputFormatter.colorize("Current Configuration:", :cyan)
  config.each do |key, value|
    puts "  #{key}: #{value}"
  end
end

#cmd_help(args) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 31

def cmd_help(args)
  if args.empty?
    display_general_help
  else
    display_command_help(args[0])
  end
end

#cmd_history(_args) ⇒ Object



39
40
41
42
43
44
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 39

def cmd_history(_args)
  history = Readline::HISTORY.to_a.last(20)
  history.each_with_index do |line, i|
    puts "#{i + 1}. #{line}"
  end
end

#cmd_stats(_args) ⇒ Object



57
58
59
60
61
62
63
64
65
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 57

def cmd_stats(_args)
  stats = repository.statistics

  if config[:icons]
    puts EnhancedFormatter.format_stats_enhanced(stats)
  else
    puts OutputFormatter.format_stats(stats, detailed: false)
  end
end

#display_command_help(command) ⇒ Object



107
108
109
110
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 107

def display_command_help(command)
  puts "Help for '#{command}' not yet implemented"
  puts "Use 'help' for general help"
end

#display_general_helpObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 67

def display_general_help
  puts OutputFormatter.colorize("Available Commands:", :cyan)
  puts ""

  puts OutputFormatter.colorize("Navigation:", :yellow)
  puts "  cd PATH           Change to package path"
  puts "  pwd               Print current path"
  puts "  ls [PATH]         List packages"
  puts "  tree [PATH]       Show package tree"
  puts "  up                Go to parent package"
  puts "  root              Go to ModelRoot"
  puts "  back              Go to previous location"
  puts ""

  puts OutputFormatter.colorize("Query:", :yellow)
  puts "  find CLASS        Find class (fuzzy search)"
  puts "  show class QNAME  Show class details"
  puts "  show package PATH Show package details"
  puts "  show NUMBER       Show numbered result"
  puts "  search QUERY      Full-text search"
  puts "  ? QUERY           Alias for search"
  puts ""

  puts OutputFormatter.colorize("Bookmarks:", :yellow)
  puts "  bookmark add NAME  Bookmark current location"
  puts "  bookmark list      List bookmarks"
  puts "  bookmark go NAME   Jump to bookmark"
  puts "  bookmark rm NAME   Remove bookmark"
  puts "  bm NAME            Quick jump"
  puts ""

  puts OutputFormatter.colorize("Utilities:", :yellow)
  puts "  help [COMMAND]    Show help"
  puts "  history           Show command history"
  puts "  clear             Clear screen"
  puts "  config            Show configuration"
  puts "  stats             Show statistics"
  puts "  exit, quit, q     Exit shell"
end

#display_welcomeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 10

def display_welcome
  puts OutputFormatter.colorize(
    "╔═══════════════════════════════════════╗", :cyan
  )
  puts OutputFormatter.colorize(
    "║  LutaML Interactive Shell (REPL)     ║", :cyan
  )
  puts OutputFormatter.colorize(
    "╚═══════════════════════════════════════╝", :cyan
  )
  puts ""
  puts "Type 'help' for available commands, 'exit' to quit"
  puts ""

  stats = repository.statistics
  puts "Repository loaded:"
  puts "  #{stats[:total_packages]} packages, " \
       "#{stats[:total_classes]} classes"
  puts ""
end