Method: Dry::CLI::Usage.arguments
- Defined in:
- lib/dry/cli/usage.rb
.arguments(command) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/dry/cli/usage.rb', line 54 def self.arguments(command) return unless CLI.command?(command) required_arguments = command.required_arguments optional_arguments = command.optional_arguments required = required_arguments.map { |arg| arg.name.upcase }.join(" ") if required_arguments.any? # rubocop:disable Layout/LineLength optional = optional_arguments.map { |arg| "[#{arg.name.upcase}]" }.join(" ") if optional_arguments.any? # rubocop:disable Layout/LineLength result = [required, optional].compact " #{result.join(" ")}" unless result.empty? end |