Sha256: 48056f363917a0eee18a093ad4b5e2b2502a6319a445c105f3d87844713e10bc
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
module Rbnotes::Commands # 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. class Delete < Command def description # :nodoc: "Delete a note" end 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 def help # :nodoc: puts <<HELP usage: #{Rbnotes::NAME} delete [TIMESTAMP] Delete a given note. TIMESTAMP must be a fully qualified one, such "20201016165130" or "20201016165130_012" if it has a suffix. Delete reads its argument from the standard input when no argument was passed in the command line. HELP end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rbnotes-0.4.5 | lib/rbnotes/commands/delete.rb |
rbnotes-0.4.4 | lib/rbnotes/commands/delete.rb |
rbnotes-0.4.3 | lib/rbnotes/commands/delete.rb |