Class: Nesta::Commands::Edit

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/nesta/commands.rb

Instance Method Summary (collapse)

Methods included from Command

#copy_template, #copy_templates, #fail, #template_root, #update_config_yaml

Constructor Details

- (Edit) initialize(*args)



56
57
58
# File 'lib/nesta/commands.rb', line 56

def initialize(*args)
  @filename = Nesta::Config.page_path(args.shift)
end

Instance Method Details

- (Object) execute



60
61
62
63
64
65
66
# File 'lib/nesta/commands.rb', line 60

def execute
  editor = ENV.fetch('EDITOR')
rescue IndexError
  $stderr.puts "No editor: set EDITOR environment variable"
else
  system(editor, @filename)
end