Class: Rbnotes::Commands::Delete
- Defined in:
- lib/rbnotes/commands/delete.rb
Overview
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.
Instance Method Summary collapse
-
#description ⇒ Object
:nodoc:.
- #execute(args, conf) ⇒ Object
-
#help ⇒ Object
:nodoc:.
Instance Method Details
#description ⇒ Object
:nodoc:
11 12 13 |
# File 'lib/rbnotes/commands/delete.rb', line 11 def description # :nodoc: "Delete a note" end |
#execute(args, conf) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rbnotes/commands/delete.rb', line 15 def execute(args, conf) stamp = Rbnotes.utils.(args) repo = Textrepo.init(conf) begin repo.delete(stamp) rescue Textrepo::MissingTimestampError => e puts e. rescue StandardError => e puts e. else puts "Delete [%s]" % stamp.to_s end end |
#help ⇒ Object
:nodoc:
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rbnotes/commands/delete.rb', line 30 def help # :nodoc: puts "usage:\n\#{Rbnotes::NAME} delete [TIMESTAMP]\n\nDelete a given note. TIMESTAMP must be a fully qualified one, such\n\"20201016165130\" or \"20201016165130_012\" if it has a suffix.\n\nDelete reads its argument from the standard input when no argument was\npassed in the command line.\n" end |