lib/geny/command.rb in geny-0.1.0 vs lib/geny/command.rb in geny-1.0.0

- old
+ new

@@ -16,13 +16,14 @@ # The root directory for the command # @return [String] attr_reader :root # Create a new command + # @param registry [Registry] registry used to find this command # @param name [String] name of the command # @param root [String] name of the command - def initialize(name:, root:) + def initialize(name:, root:, registry:) @name = name @root = root end # The path where the command is located @@ -55,10 +56,13 @@ parser.description end # Parse command-line options # @param argv [Array<String>] + # @raise [Argy::ParseError] when the arguments are invalid + # @raise [Argy::CoersionError] when the arguments cannot be coerced + # @raise [Argy::ValidationError] when required arguments are missing # @return [Argy::Options] def parse(argv) parser.parse(argv) end @@ -68,9 +72,10 @@ options = parse(argv) invoke!(options.to_h) end # Invoke a command with options + # @raise [Argy::ValidationError] when required arguments are missing # @param options [Hash{Symbol => Object}] def invoke(**options) options = parser.default_values.merge(options) parser.validate!(options) invoke!(options)