Class: Nesta::Commands::Edit

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

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Edit

Returns a new instance of Edit.



4
5
6
# File 'lib/nesta/commands/edit.rb', line 4

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

Instance Method Details

#execute(process) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/nesta/commands/edit.rb', line 8

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