-
Notifications
You must be signed in to change notification settings - Fork 201
Feature Sets
The ShopifyCli::Feature
class can be used to check if a feature is enabled to optionally enable certain codepaths. These can be enabled and disabled by calling shopify config feature [feature_name] --enable/--disable
So you can have code that looks like
@ctx.puts("debug info") if ShopifyCli::Feature.enabled?(:debug_outputs)
And to get it to work, call
shopify config feature :debug_outputs --enable
These will persist until --disable
is called
ShopifyCli::Feature.enable(feature)
will enable a feature in the CLI.
-
feature
- a symbol representing the flag to be enabled
ShopifyCli::Feature.disable(feature)
Will disable a feature in the CLI.
-
feature
- a symbol representing the flag to be disabled
ShopifyCli::Feature.enabled?(feature)
will check if the feature has been enabled
-
feature
- a symbol representing a flag that the status should be requested
-
is_enabled
- will be true if the feature has been enabled.
ShopifyCli::Feature::Set is included in each command and project type. It allows you to optionally hide and show commands and projects.
hidden_feature(feature_set: [])
Will hide a the object the method is being called on (project_type or command) and will be able to be optionally shown when enabled
-
feature_set
- A symbol or array of symbols that represent a feature set.
project = ShopifyCli::Project.current
see source
module Foo
class Command < ShopifyCli::ProjectCommands
hidden_feature(feature_set: :foo_project)
end
end