2323require "console"
2424
2525module Teapot
26+ # @namespace
2627 module Command
28+ # Represents the top-level command for the teapot CLI.
2729 class Top < Samovar ::Command
2830 self . description = "A decentralised package manager and build tool."
2931
@@ -46,18 +48,26 @@ class Top < Samovar::Command
4648 "clean" => Clean ,
4749 } , default : "build"
4850
51+ # The project root directory, either from --root option or current working directory.
52+ # @returns [Build::Files::Path] The root directory path.
4953 def root
5054 ::Build ::Files ::Path . expand ( @options [ :root ] || Dir . getwd )
5155 end
5256
57+ # Whether verbose logging is enabled via --verbose flag.
58+ # @returns [Boolean] True if verbose mode is enabled.
5359 def verbose?
5460 @options [ :logging ] == :verbose
5561 end
5662
63+ # Whether quiet logging is enabled via --quiet flag.
64+ # @returns [Boolean] True if quiet mode is enabled.
5765 def quiet?
5866 @options [ :logging ] == :quiet
5967 end
6068
69+ # Get the logger for the command.
70+ # @returns [Console::Logger] The configured logger instance.
6171 def logger
6272 @logger ||= Console ::Logger . new ( Console . logger , verbose : self . verbose? ) . tap do |logger |
6373 if verbose?
@@ -70,14 +80,20 @@ def logger
7080 end
7181 end
7282
83+ # The build configuration name from -c option or TEAPOT_CONFIGURATION environment variable.
84+ # @returns [String | Nil] The configuration name if specified.
7385 def configuration
7486 @options [ :configuration ]
7587 end
7688
89+ # Create a context for the project.
90+ # @parameter root [Build::Files::Path] The root directory path.
91+ # @returns [Context] A new context instance.
7792 def context ( root = self . root )
7893 Context . new ( root , configuration : configuration )
7994 end
8095
96+ # Execute the command.
8197 def call
8298 if @options [ :version ]
8399 puts "teapot v#{ Teapot ::VERSION } "
0 commit comments