Sha256: c77f946856bcfd670f440fdb7e247ac09e195b1125300f777b4dc0380d3a84a5

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require "firestore"

module Icarus
  module Mod
    module CLI
      # Sync CLI command definitions
      class Add < SubcommandBase
        desc "modinfo", "Adds an entry to 'meta/modinfo/list'"
        def modinfo(item)
          firestore = Firestore.new
          payload = [firestore.list(:modinfo), item].flatten.compact

          puts firestore.update(:modinfo, payload, merge: true) ? "Success" : "Failure"
        end

        desc "toolinfo", "Adds an entry to 'meta/toolinfo/list'"
        def toolinfo(item)
          firestore = Firestore.new
          payload = [firestore.list(:toolinfo), item].flatten.compact

          puts firestore.update(:toolinfo, payload, merge: true) ? "Success" : "Failure"
        end

        desc "repos", "Adds an entry to 'meta/repos/list'"
        def repos(item)
          firestore = Firestore.new
          payload = [firestore.list(:repositories), item].flatten.compact

          puts firestore.update(:repositories, payload, merge: true) ? "Success" : "Failure"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Icarus-Mod-Tools-1.9.0 lib/icarus/mod/cli/add.rb