Module: AM::MessageControl
Constant Summary collapse
- NOTICE_MESSAGE =
{ config_empty: 'config is empty', success_add_command: "success! %s / %s added command\n please run: [ aml ] or [ source %s ]", success_delete_command: "success! %s delete alias\n please run: [ source %s ]" }
- WARNING_MESSAGE =
{ add_command: "%s / %s couldn't add command", empty_config_number: "selected number missing in current config", validate_number: "please input valid number", validate_number_range: "please input number 1-%s", validate_alias: 'input using a-z or 0-9 or _ or -', }
- ERROR_MESSAGE =
{ add_command_fail: "%s / %s couldn't add command", validate_length_zero: "%s / %s length equal 0", delete_command_fail: "fail delete alias %s", duplicate_alias: "duplicate alias is '%s'", duplicate_command: "duplicate command is %s", no_support: "does not support is %s", not_exists_history_file: "history file not found %s", not_exists_history_record: "history record not exists" }
Instance Method Summary collapse
- #after_sepalate ⇒ Object
- #before_sepalate ⇒ Object
- #error(code, val = nil) ⇒ Object
- #notice(code, val = nil) ⇒ Object
- #print_message(template, prefix, code, val = nil) ⇒ Object
- #warning(code, val = nil) ⇒ Object
Instance Method Details
#after_sepalate ⇒ Object
52 53 54 55 |
# File 'lib/message_control.rb', line 52 def after_sepalate puts '='*60 puts '' end |
#before_sepalate ⇒ Object
47 48 49 50 |
# File 'lib/message_control.rb', line 47 def before_sepalate puts '' puts '='*60 end |
#error(code, val = nil) ⇒ Object
36 37 38 39 |
# File 'lib/message_control.rb', line 36 def error(code, val=nil) (ERROR_MESSAGE, 'error', code, val) exit end |
#notice(code, val = nil) ⇒ Object
29 30 31 |
# File 'lib/message_control.rb', line 29 def notice(code, val=nil) (NOTICE_MESSAGE, 'info', code, val) end |
#print_message(template, prefix, code, val = nil) ⇒ Object
41 42 43 44 45 |
# File 'lib/message_control.rb', line 41 def (template, prefix, code, val=nil) before_sepalate puts "[#{prefix}] #{template[code]}"%val after_sepalate end |
#warning(code, val = nil) ⇒ Object
33 34 35 |
# File 'lib/message_control.rb', line 33 def warning(code, val=nil) (WARNING_MESSAGE, 'warning', code, val) end |