Sha256: 92349d473137d12a8d8423bddb34c4bb442a4b0d5dc32151a63d67bd4e7523c6

Contents?: true

Size: 936 Bytes

Versions: 1

Compression:

Stored size: 936 Bytes

Contents

module Geny
  module Actions
    # Run Geny commands from within a Geny invocation. Whoa, meta.
    class Geny
      # Create a new Geny
      # @param registry [Registry]
      def initialize(registry:)
        @registry = registry
      end

      # Run a command with arguments
      # @param name [String] name of the command
      # @param argv [Array<String>] command-line arguments
      #
      # @example
      #   geny.run "rails:model", "--name", "User"
      def run(name, *argv)
        command = @registry.find!(name)
        command.run(argv)
      end

      # Run a command with options
      # @param name [String] name of the command
      # @param options [Hash{Symbol => Object}] options for the command
      #
      # @example
      #   geny.invoke "rails:model", name: "User"
      def invoke(name, **options)
        command = @registry.find!(name)
        command.invoke(**options)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geny-2.5.2 lib/geny/actions/geny.rb