Sha256: a544b41b68594e7d4149964e32322fb09bbd28fdafa743588b53c38d3766c13c

Contents?: true

Size: 657 Bytes

Versions: 8

Compression:

Stored size: 657 Bytes

Contents

module HammerCLI
  module Bash
    class PrebuildCompletionCommand < HammerCLI::AbstractCommand
      def execute
        map = HammerCLI::MainCommand.completion_map
        cache_file = HammerCLI::Settings.get(:completion_cache_file)
        cache_dir = File.dirname(cache_file)
        FileUtils.mkdir_p(cache_dir) unless File.directory?(cache_dir)
        File.write(File.expand_path(cache_file), map.to_json)

        HammerCLI::EX_OK
      end
    end
  end

  HammerCLI::MainCommand.subcommand(
    'prebuild-bash-completion',
    _('Prepare map of options and subcommands for Bash completion'),
    HammerCLI::Bash::PrebuildCompletionCommand
  )
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hammer_cli-2.3.1 lib/hammer_cli/bash/prebuild_command.rb
hammer_cli-2.3.0 lib/hammer_cli/bash/prebuild_command.rb
hammer_cli-2.2.1 lib/hammer_cli/bash/prebuild_command.rb
hammer_cli-2.1.2 lib/hammer_cli/bash/prebuild_command.rb
hammer_cli-2.2.0 lib/hammer_cli/bash/prebuild_command.rb
hammer_cli-2.1.1 lib/hammer_cli/bash/prebuild_command.rb
hammer_cli-2.1.0 lib/hammer_cli/bash/prebuild_command.rb
hammer_cli-2.0.0 lib/hammer_cli/bash/prebuild_command.rb