Sha256: d7b75a397f25bbd6a7683e6b289aee6ca6a76fa743d8f88a0cf61a666f02b88a

Contents?: true

Size: 448 Bytes

Versions: 2

Compression:

Stored size: 448 Bytes

Contents

# frozen_string_literal: true

require 'snippit/io'

module Snippit
  class CLI
    # Snippit::CLI::Delete deletes a snippet.
    class Delete
      include Snippit::IO

      def initialize(slug)
        @slug = slug
      end

      # Starts the delete subcommand.
      #
      # @return [Integer] the exit code
      def start
        return 1 unless definitions.key?(@slug)

        delete_snippet(@slug)
        0
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
snippit-1.0.1 lib/snippit/cli/delete.rb
snippit-1.0.0 lib/snippit/cli/delete.rb