class Rbnotes::Commands::Delete

Deletes a given note in the repository. The timestamp string must be a fully qualified one, like “20201016165130”. If no argument was passed, it would try to read from the standard input.

It does nothing to change the repository when the specified note does not exist.

Public Instance Methods

execute(args, conf) click to toggle source
# File lib/rbnotes/commands/delete.rb, line 15
def execute(args, conf)
  stamp = Rbnotes.utils.read_timestamp(args)

  repo = Textrepo.init(conf)
  begin
    repo.delete(stamp)
  rescue Textrepo::MissingTimestampError => e
    puts e.message
  rescue StandardError => e
    puts e.message
  else
    puts "Delete [%s]" % stamp.to_s
  end
end