Sha256: 88a3c1f669a221ad298f6fe201fed3e2ff99b05e83ecc3bc3ab4436741b5d230

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

module Mythal
  class CLI < Thor

    desc "roll", "roll some number of dice, plus modifiers e.g. 1d20, or 3d8 + 4"

    def roll(*args)
      puts Mythal::Roll.call(*args).message
    end

    desc "npc", "generate a random npc, e.g. 'a half-orc barbarian'"
    method_option :challenge_rating, type: :string, aliases: "--cr"
    method_option :options, type: :hash, aliases: "-o"

    def npc
      puts Mythal::Npc.call(
        challenge_rating: options[:challenge_rating],
        user_overrides: options[:options]&.transform_keys(&:to_sym),
      ).message
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mythal-0.2.1 lib/mythal/cli.rb