Module: ShopifyCLI::Feature::Set

Included in:
Command, ProjectType
Defined in:
lib/shopify_cli/feature.rb

Overview

ShopifyCLI::Feature::Set is included on commands and projects to allow you to hide and enable projects and commands based on feature flags.

Instance Method Summary collapse

Instance Method Details

#hidden?Boolean

will return if the feature has been hidden or not

#### Returns

  • ‘is_hidden` - returns true if the feature has been hidden and false otherwise

#### Example

ShopifyCLI::Commands::Config.hidden?

Returns:

  • (Boolean)


46
47
48
49
50
51
# File 'lib/shopify_cli/feature.rb', line 46

def hidden?
  enabled = (@hidden_feature_set || []).any? do |feature|
    Feature.enabled?(feature)
  end
  @feature_hidden && !enabled
end

#hidden_feature(feature_set: []) ⇒ Object

will hide a feature, either a project_type or a command

#### Parameters

  • ‘feature_set` - either a single, or array of symbols that represent feature sets

#### Example

module ShopifyCLI
  module Commands
    class Config < ShopifyCLI::Command
      hidden_feature(feature_set: :basic)
      ....


30
31
32
33
# File 'lib/shopify_cli/feature.rb', line 30

def hidden_feature(feature_set: [])
  @feature_hidden = true
  @hidden_feature_set = Array(feature_set).compact
end