Class: ShowHelp
- Inherits:
-
Object
- Object
- ShowHelp
- Defined in:
- lib/tng/ui/show_help.rb
Instance Attribute Summary collapse
-
#pastel ⇒ Object
readonly
Returns the value of attribute pastel.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(pastel, version) ⇒ ShowHelp
constructor
A new instance of ShowHelp.
- #render ⇒ Object
Constructor Details
#initialize(pastel, version) ⇒ ShowHelp
Returns a new instance of ShowHelp.
9 10 11 12 13 14 15 16 17 |
# File 'lib/tng/ui/show_help.rb', line 9 def initialize(pastel, version) @pastel = pastel @version = version @terminal_width = begin TTY::Screen.width rescue StandardError 80 end end |
Instance Attribute Details
#pastel ⇒ Object (readonly)
Returns the value of attribute pastel.
7 8 9 |
# File 'lib/tng/ui/show_help.rb', line 7 def pastel @pastel end |
Instance Method Details
#content ⇒ Object
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 51 52 53 54 55 56 57 58 |
# File 'lib/tng/ui/show_help.rb', line 19 def content [ @pastel.public_send(Tng::UI::Theme.color(:secondary)).bold("TNG - LLM-Powered Rails Test Generator"), @pastel.public_send(Tng::UI::Theme.color(:muted), "Version: #{@version}"), "", @pastel.public_send(Tng::UI::Theme.color(:accent)).bold("Usage:"), @pastel.public_send(Tng::UI::Theme.color(:primary), " bundle exec tng") + @pastel.public_send(Tng::UI::Theme.color(:muted), " # Interactive mode only"), "", @pastel.public_send(Tng::UI::Theme.color(:accent)).bold("Features:"), @pastel.public_send(Tng::UI::Theme.color(:success), " #{Tng::UI::Theme.icon(:bullet)} Controllers, Models, Services"), @pastel.public_send(Tng::UI::Theme.color(:success), " #{Tng::UI::Theme.icon(:bullet)} 17+ other file types (Jobs, Helpers, Lib, Policies, Presenters, Mailers, GraphQL, etc.)"), @pastel.public_send(Tng::UI::Theme.color(:success), " #{Tng::UI::Theme.icon(:bullet)} Per-method test generation"), @pastel.public_send(Tng::UI::Theme.color(:success), " #{Tng::UI::Theme.icon(:bullet)} Searchable method lists"), "", @pastel.public_send(Tng::UI::Theme.color(:accent)).bold("Options:"), @pastel.public_send(Tng::UI::Theme.color(:primary), " -h, --help") + @pastel.public_send(Tng::UI::Theme.color(:muted), " Show this help message"), "", @pastel.public_send(Tng::UI::Theme.color(:accent)).bold("How to Use:"), @pastel.public_send(Tng::UI::Theme.color(:muted), " #{Tng::UI::Theme.icon(:bullet)} Run 'bundle exec tng' to start the interactive interface"), @pastel.public_send(Tng::UI::Theme.color(:muted), " #{Tng::UI::Theme.icon(:bullet)} Select Controller, Model, Service, or Other to test"), @pastel.public_send(Tng::UI::Theme.color(:muted), " #{Tng::UI::Theme.icon(:bullet)} Choose a specific method from the list"), @pastel.public_send(Tng::UI::Theme.color(:muted), " #{Tng::UI::Theme.icon(:bullet)} Use search/filter to find methods quickly"), "", @pastel.public_send(Tng::UI::Theme.color(:secondary)).bold("Happy testing! ") + @pastel.public_send( Tng::UI::Theme.color(:accent), "★" ) ].join("\n") end |
#render ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/tng/ui/show_help.rb', line 60 def render # Use a reasonable width that matches other UI components box_width = Tng::UI::Theme.calculate_box_width(@terminal_width) box_width = [box_width, 80].min # Allow wider for help content style = Tng::UI::Theme.box_style(:default) box = TTY::Box.frame( title: { top_left: " TNG Help ", bottom_right: " v#{@version} " }, style: style[:style], padding: style[:padding], align: :left, width: box_width ) do content end Tng::UI::Theme.center_box(box, box_width, @terminal_width) end |