Sha256: 17d3c1af027f7c3b33034023f55ebaaf64407c81d28cd72a35d68d57d4246a57

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

module Cosensee
  class CLI
    # Option class for Cosensee::CLI
    class Option
      attr_accessor :port, :output_dir, :css_dir
      attr_writer :failed, :server, :remote, :filename, :skip_tailwind_execution, :init, :clean

      def initialize(filename: nil, remote: nil, port: DEFAULT_PORT, output_dir: DEFAULT_OUTPUT_DIR, css_dir: DEFAULT_CSS_DIR, server: nil, skip_tailwind_execution: false, init: nil, clean: false, base_url: nil)
        @remote = remote
        @filename = filename
        @port = port
        @output_dir = output_dir
        @css_dir = css_dir
        @server = server
        @skip_tailwind_execution = skip_tailwind_execution
        @failed = false
        @clean = clean
        @init = init
        @base_url = base_url
      end

      def filename
        @filename || ENV['COSENSEE_FILENAME']
      end

      def project_name
        @remote || ENV['COSENSEE_PROJECT_NAME']
      end

      def base_url
        @base_url || ENV['COSENSEE_BASE_URL']
      end

      def project_dir
        @init || '.'
      end

      def remote?
        !!@remote
      end

      def failed?
        @failed
      end

      def server?
        @server
      end

      def skip_tailwind_execution?
        @skip_tailwind_execution
      end

      def clean?
        @clean
      end

      def init?
        !!@init
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cosensee-0.8.0 lib/cosensee/cli/option.rb