class Dotfiler::CLI::Commands::Edit
Public Instance Methods
call(name:, **options)
click to toggle source
# File lib/dotfiler/cli/commands/edit.rb, line 12 def call(name:, **options) handle_errors do validate_name!(name) dotfile_path = dotfiles.find(name).path.to_s editor = options.fetch(:with, default_editor) error!("Editor is not specified. Either set the '$EDITOR' environment variable or provide '--with' option") unless editor fs.execute(editor, dotfile_path) end end
Private Instance Methods
default_editor()
click to toggle source
# File lib/dotfiler/cli/commands/edit.rb, line 31 def default_editor ENV["EDITOR"] end
validate_name!(name)
click to toggle source
# File lib/dotfiler/cli/commands/edit.rb, line 27 def validate_name!(name) error!("Dotfile '#{name}' not found") unless dotfiles.exists?(name) end