Sha256: 8868f52288b201eb3074c8c0a13f327e9676bc9610824860b589b96abcd123cf

Contents?: true

Size: 1.87 KB

Versions: 1

Compression:

Stored size: 1.87 KB

Contents

# frozen_string_literal: true
#
# Copyright (c) 2021-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
#
# ronin-repos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ronin-repos is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with ronin-repos.  If not, see <https://www.gnu.org/licenses/>.
#

require 'ronin/repos/root'
require 'ronin/repos/cache_dir'

require 'ronin/core/cli/command'

module Ronin
  module Repos
    class CLI
      #
      # Base command for all `ronin-repos` commands.
      #
      class Command < Core::CLI::Command

        man_dir File.join(ROOT,'man')

        bug_report_url 'https://github.com/ronin-rb/ronin-repos/issues/new'

        option :cache_dir, short: '-C',
                           value: {
                             type:  String,
                             usage: 'DIR'
                           },
                           desc: 'Overrides the default cache directory' do |dir|
                             @cache_dir = CacheDir.new(dir)
                           end

        # The `ronin-repos` cache directory.
        #
        # @return [CacheDir]
        attr_reader :cache_dir

        #
        # Initializes the command.
        #
        # @param [Hash{Symbol => Object}] kwargs
        #   Additional keyword arguments for `initialize`.
        #
        def initialize(**kwargs)
          super(**kwargs)

          @cache_dir = CacheDir.new
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ronin-repos-0.1.1 lib/ronin/repos/cli/command.rb