Sha256: 490434d8415d04cc16093569624a79c9221c93daf753b8f9f08e23426b76b111
Contents?: true
Size: 1013 Bytes
Versions: 3
Compression:
Stored size: 1013 Bytes
Contents
GLI.desc 'Get/set configuration settings' arg_name "setting [new_value]" command :config do |c| c.desc "Save to global configuration" c.switch [:g, :global] c.action do |global_options,options,args| Glyph.run 'load:config' if options[:g] then config = Glyph::GLOBAL_CONFIG else config = Glyph::PROJECT_CONFIG end case args.length when 0 then raise ArgumentError, "Too few arguments." when 1 then # read current config setting = Glyph[args[0]] raise RuntimeError, "Unknown setting '#{args[0]}'" if setting.blank? Glyph.info setting.inspect when 2 then if args[0].match /^system\..+/ then Glyph.warning "Cannot reset '#@value' setting (system use only)." else # Remove all overrides Glyph.config_reset # Reload current project config config.read config.set args[0], args[1] # Write changes to file config.write # Refresh configuration Glyph.config_refresh end else raise ArgumentError, "Too many arguments." end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
glyph-0.4.2 | lib/glyph/commands/config.rb |
glyph-0.4.1 | lib/glyph/commands/config.rb |
glyph-0.4.0 | lib/glyph/commands/config.rb |