Class: HammerCLI::Bash::PrebuildCompletionCommand

Inherits:
AbstractCommand
  • Object
show all
Defined in:
lib/hammer_cli/bash/prebuild_command.rb

Instance Method Summary collapse

Methods inherited from AbstractCommand

#adapter, add_sets_help, build_options, command_extensions, #exception_handler, extend_help, extend_options_help, extend_output_definition, extend_with, help, #help, help_extension_blocks, inherited_command_extensions, #initialize, #interactive?, option_builder, output, #output, output_definition, #output_definition, #parent_command, #parse, #run, use_option, #validate_options, validate_options

Methods included from Subcommand

included

Constructor Details

This class inherits a constructor from HammerCLI::AbstractCommand

Instance Method Details

#executeObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/hammer_cli/bash/prebuild_command.rb', line 4

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

  HammerCLI::EX_OK
end