Sha256: e2676c7f46deb18dcbd3f26baf168b39b1dfda24730d15227c1c96052de54872

Contents?: true

Size: 1.09 KB

Versions: 20

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require "sod"

module Git
  module Lint
    module CLI
      # The main Command Line Interface (CLI) object.
      class Shell
        include Import[:defaults_path, :xdg_config, :specification]

        def initialize(context: Sod::Context, dsl: Sod, **)
          super(**)
          @context = context
          @dsl = dsl
        end

        def call(...) = cli.call(...)

        private

        attr_reader :context, :dsl

        def cli
          context = build_context

          dsl.new "git-lint", banner: specification.banner do
            on(Sod::Prefabs::Commands::Config, context:)

            on "analyze", "Analyze branch or commit(s)." do
              on Actions::Analyze::Branch
              on Actions::Analyze::Commit
            end

            on Actions::Hook
            on(Sod::Prefabs::Actions::Version, context:)
            on Sod::Prefabs::Actions::Help, self
          end
        end

        def build_context
          context[defaults_path:, xdg_config:, version_label: specification.labeled_version]
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
git-lint-8.8.0 lib/git/lint/cli/shell.rb
git-lint-8.7.0 lib/git/lint/cli/shell.rb
git-lint-8.6.0 lib/git/lint/cli/shell.rb
git-lint-8.5.0 lib/git/lint/cli/shell.rb
git-lint-8.4.0 lib/git/lint/cli/shell.rb
git-lint-8.3.0 lib/git/lint/cli/shell.rb
git-lint-8.2.0 lib/git/lint/cli/shell.rb
git-lint-8.1.0 lib/git/lint/cli/shell.rb
git-lint-8.0.0 lib/git/lint/cli/shell.rb
git-lint-7.5.0 lib/git/lint/cli/shell.rb
git-lint-7.3.0 lib/git/lint/cli/shell.rb
git-lint-7.2.0 lib/git/lint/cli/shell.rb
git-lint-7.1.0 lib/git/lint/cli/shell.rb
git-lint-7.0.0 lib/git/lint/cli/shell.rb
git-lint-6.2.1 lib/git/lint/cli/shell.rb
git-lint-6.2.0 lib/git/lint/cli/shell.rb
git-lint-6.1.0 lib/git/lint/cli/shell.rb
git-lint-6.0.2 lib/git/lint/cli/shell.rb
git-lint-6.0.1 lib/git/lint/cli/shell.rb
git-lint-6.0.0 lib/git/lint/cli/shell.rb