Class: Completely::Command

Inherits:
MisterBin::Command
  • Object
show all
Defined in:
lib/completely/command.rb

Instance Method Summary collapse

Instance Method Details

#generate_commandObject



43
44
45
46
47
48
49
# File 'lib/completely/command.rb', line 43

def generate_command
  wrap = args['--wrap']
  output = wrap ? wrapper_function(wrap) : script
  File.write output_path, output
  say "Saved !txtpur!#{output_path}"
  syntax_warning unless completions.valid?
end

#new_commandObject



29
30
31
32
33
34
35
36
# File 'lib/completely/command.rb', line 29

def new_command
  if File.exist? config_path
    raise "File already exists: #{config_path}"
  else
    File.write config_path, sample
    say "Saved !txtpur!#{config_path}"
  end
end

#preview_commandObject



38
39
40
41
# File 'lib/completely/command.rb', line 38

def preview_command
  puts script
  syntax_warning unless completions.valid?
end