lib/scss_beautifier/cli.rb in scss_beautifier-0.1.17 vs lib/scss_beautifier/cli.rb in scss_beautifier-0.1.18
- old
+ new
@@ -3,10 +3,11 @@
DEFAULT = File.realpath(File.join(File.dirname(__FILE__), "..", "..", "data", "default_config.yml")).freeze
# Takes an array of arguments
# Returns exit code
def run(args)
options = Options.new.parse(args)
+ generate_configuration and return if options[:generate_config]
contents = File.read(args.first)
engine = Sass::Engine.new(contents, cache: false, syntax: :scss)
tree = engine.to_tree
@@ -20,9 +21,15 @@
if options[:in_place]
File.write(args.first, output)
else
puts output
end
+ end
+
+ private
+
+ def generate_configuration
+ File.write(".scss-beautifier", File.read(DEFAULT))
end
end
end