Class: Vaulty::CLI::Delete
Instance Attribute Summary collapse
-
#catacomb ⇒ Object
readonly
Returns the value of attribute catacomb.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(catacomb:) ⇒ Delete
constructor
A new instance of Delete.
Methods inherited from Command
#banner, call, #prompt, #table
Constructor Details
#initialize(catacomb:) ⇒ Delete
Returns a new instance of Delete.
5 6 7 |
# File 'lib/vaulty/cli/delete.rb', line 5 def initialize(catacomb:) @catacomb = catacomb end |
Instance Attribute Details
#catacomb ⇒ Object (readonly)
Returns the value of attribute catacomb.
4 5 6 |
# File 'lib/vaulty/cli/delete.rb', line 4 def catacomb @catacomb end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/vaulty/cli/delete.rb', line 9 def call ("Current value #{catacomb.path.inspect}") # Render the tree first so the user knows what we will delete vaulty_tree = Vaulty::CLI::Tree.call(catacomb: catacomb) # Confirmation return if prompt.no?('All above data will be ' \ 'recursively deleted! Are you sure?', color: :red) (catacomb.path, color: :red) # Start deleting delete_recursively(vaulty_tree.children, [catacomb.path]) # Delete the route of the path catacomb.delete prompt.ok("Successfully deleted everything in path #{catacomb.path}") end |