Class: Lutaml::Cli::InteractiveShell::HelpDisplay
- Inherits:
-
CommandBase
- Object
- CommandBase
- Lutaml::Cli::InteractiveShell::HelpDisplay
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
Instance Method Details
#cmd_clear(_args) ⇒ Object
42
43
44
|
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 42
def cmd_clear(_args)
print "\e[2J\e[H"
end
|
#cmd_config(_args) ⇒ Object
46
47
48
49
50
51
|
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 46
def cmd_config(_args)
puts OutputFormatter.colorize("Current Configuration:", :cyan)
config.each do |key, value|
puts " #{key}: #{value}"
end
end
|
#cmd_help(args) ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 27
def cmd_help(args)
if args.empty?
display_general_help
else
display_command_help(args[0])
end
end
|
#cmd_history(_args) ⇒ Object
35
36
37
38
39
40
|
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 35
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
#display_command_help(command) ⇒ Object
101
102
103
104
|
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 101
def display_command_help(command)
puts "Help for '#{command}' not yet implemented"
puts "Use 'help' for general help"
end
|
#display_general_help ⇒ Object
63
64
65
66
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
|
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 63
def display_general_help
puts <<~HELP
#{OutputFormatter.colorize('Available Commands:', :cyan)}
#{OutputFormatter.colorize('Navigation:', :yellow)}
cd PATH Change to package path
pwd Print current path
ls [PATH] List packages
tree [PATH] Show package tree
up Go to parent package
root Go to ModelRoot
back Go to previous location
#{OutputFormatter.colorize('Query:', :yellow)}
find CLASS Find class (fuzzy search)
show class QNAME Show class details
show package PATH Show package details
show NUMBER Show numbered result
search QUERY Full-text search
? QUERY Alias for search
#{OutputFormatter.colorize('Bookmarks:', :yellow)}
bookmark add NAME Bookmark current location
bookmark list List bookmarks
bookmark go NAME Jump to bookmark
bookmark rm NAME Remove bookmark
bm NAME Quick jump
#{OutputFormatter.colorize('Utilities:', :yellow)}
help [COMMAND] Show help
history Show command history
clear Clear screen
config Show configuration
stats Show statistics
exit, quit, q Exit shell
HELP
end
|
#display_welcome ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/lutaml/cli/interactive_shell/help_display.rb', line 10
def display_welcome
puts <<~WELCOME
#{OutputFormatter.colorize('╔═══════════════════════════════════════╗', :cyan)}
#{OutputFormatter.colorize('║ LutaML Interactive Shell (REPL) ║', :cyan)}
#{OutputFormatter.colorize('╚═══════════════════════════════════════╝', :cyan)}
Type 'help' for available commands, 'exit' to quit
WELCOME
stats = repository.statistics
puts "Repository loaded:"
puts " #{stats[:total_packages]} packages, " \
"#{stats[:total_classes]} classes"
puts ""
end
|