Class: AudioAddict::Commands::ConfigCmd
- Inherits:
-
Base
- Object
- MisterBin::Command
- Base
- AudioAddict::Commands::ConfigCmd
show all
- Defined in:
- lib/audio_addict/commands/config.rb
Instance Method Summary
collapse
Methods inherited from Base
#current_channel, #current_network, #needs, #prompt, #radio, #require_premium_account
Instance Method Details
#del_command ⇒ Object
46
47
48
49
50
51
|
# File 'lib/audio_addict/commands/config.rb', line 46
def del_command
key = args['KEY'].to_sym
Config.delete key
Config.save
say "!txtgrn!Deleted"
end
|
#edit_command ⇒ Object
62
63
64
65
|
# File 'lib/audio_addict/commands/config.rb', line 62
def edit_command
editor = ENV['EDITOR'] || 'vi'
system "#{editor} #{Config.path}"
end
|
#get_command ⇒ Object
32
33
34
35
36
|
# File 'lib/audio_addict/commands/config.rb', line 32
def get_command
key = args['KEY'].to_sym
value = Config.properties[key]
say value ? "!txtgrn!#{value}" : "!txtred!<Unset>"
end
|
#guide_command ⇒ Object
67
68
69
70
71
72
73
|
# File 'lib/audio_addict/commands/config.rb', line 67
def guide_command
key_guide.each do |key, value|
say "!txtgrn!#{key}"
say word_wrap " #{value}"
say ""
end
end
|
#set_command ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/audio_addict/commands/config.rb', line 38
def set_command
key = args['KEY'].to_sym
value = args['VALUE']
Config.properties[key] = value
Config.save
say "!txtgrn!#{key}=#{value}"
end
|
#show_command ⇒ Object
53
54
55
56
57
58
59
60
|
# File 'lib/audio_addict/commands/config.rb', line 53
def show_command
say "!undpur!# #{Config.path}"
if File.exist? Config.path
puts File.read Config.path
else
say "!txtred!File Not Found"
end
end
|