2019-09-23 03:46:50 +00:00
""" Print links to relevant docs. """
from . model import Info
2019-10-30 03:34:03 +00:00
DATA = {
2022-03-31 12:18:45 +00:00
" backup " : {
" title " : " Backup " ,
" docs " : " https://developers.home-assistant.io/docs/core/platform/backup " ,
} ,
2019-10-30 03:34:03 +00:00
" config_flow " : {
" title " : " Config Flow " ,
" docs " : " https://developers.home-assistant.io/docs/en/config_entries_config_flow_handler.html " ,
} ,
2022-03-16 11:57:56 +00:00
" config_flow_helper " : {
" title " : " Helper Config Flow " ,
" docs " : " https://developers.home-assistant.io/docs/en/config_entries_config_flow_handler.html#helper " ,
} ,
2019-10-30 03:34:03 +00:00
" config_flow_discovery " : {
" title " : " Discoverable Config Flow " ,
" docs " : " https://developers.home-assistant.io/docs/en/config_entries_config_flow_handler.html#discoverable-integrations-that-require-no-authentication " ,
} ,
" config_flow_oauth2 " : {
" title " : " OAuth2 Config Flow " ,
" docs " : " https://developers.home-assistant.io/docs/en/next/config_entries_config_flow_handler.html#configuration-via-oauth2 " ,
} ,
" device_action " : {
" title " : " Device Action " ,
" docs " : " https://developers.home-assistant.io/docs/en/device_automation_action.html " ,
} ,
" device_condition " : {
" title " : " Device Condition " ,
" docs " : " https://developers.home-assistant.io/docs/en/device_automation_condition.html " ,
} ,
" device_trigger " : {
" title " : " Device Trigger " ,
" docs " : " https://developers.home-assistant.io/docs/en/device_automation_trigger.html " ,
} ,
" integration " : {
" title " : " Integration " ,
" docs " : " https://developers.home-assistant.io/docs/en/creating_integration_file_structure.html " ,
} ,
" reproduce_state " : {
" title " : " Reproduce State " ,
2022-03-31 12:18:45 +00:00
" docs " : " https://developers.home-assistant.io/docs/core/platform/reproduce_state " ,
2019-10-30 03:34:03 +00:00
" extra " : " You will now need to update the code to make sure that every attribute that can occur in the state will cause the right service to be called. " ,
} ,
2021-01-26 13:13:27 +00:00
" significant_change " : {
" title " : " Significant Change " ,
2022-03-31 12:18:45 +00:00
" docs " : " https://developers.home-assistant.io/docs/core/platform/significant_change " ,
2021-01-26 13:13:27 +00:00
" extra " : " You will now need to update the code to make sure that entities with different device classes are correctly considered. " ,
} ,
2019-10-30 03:34:03 +00:00
}
2019-09-23 03:46:50 +00:00
2019-09-24 06:23:53 +00:00
2019-10-30 03:34:03 +00:00
def print_relevant_docs ( template : str , info : Info ) - > None :
""" Print relevant docs. """
data = DATA [ template ]
2019-09-27 19:54:17 +00:00
2019-10-30 03:34:03 +00:00
print ( )
print ( " ************************** " )
print ( )
print ( )
print ( f " { data [ ' title ' ] } code has been generated " )
print ( )
if info . files_added :
print ( " Added the following files: " )
for file in info . files_added :
print ( f " - { file } " )
print ( )
2019-09-27 20:08:30 +00:00
2019-10-30 03:34:03 +00:00
if info . tests_added :
print ( " Added the following tests: " )
for file in info . tests_added :
print ( f " - { file } " )
print ( )
2019-09-27 19:54:17 +00:00
2019-10-30 03:34:03 +00:00
if info . examples_added :
2019-09-27 19:54:17 +00:00
print (
2019-10-30 03:34:03 +00:00
" Because some files already existed, we added the following example files. Please copy the relevant code to the existing files. "
2019-09-27 19:54:17 +00:00
)
2019-10-30 03:34:03 +00:00
for file in info . examples_added :
print ( f " - { file } " )
print ( )
2019-09-27 19:54:17 +00:00
2019-10-30 03:34:03 +00:00
print (
2020-04-30 19:37:58 +00:00
" The next step is to look at the files and deal with all areas marked as TODO. "
2019-10-30 03:34:03 +00:00
)
2019-09-27 20:08:30 +00:00
2019-10-30 03:34:03 +00:00
if " extra " in data :
2021-01-26 13:13:27 +00:00
print ( )
2019-10-30 03:34:03 +00:00
print ( data [ " extra " ] )