|
10 | 10 | #description: various tasker config utils |
11 | 11 | #author: agnostic-apollo |
12 | 12 | #usage: run "bash tasker_config_utils --help" |
13 | | -#date: 13-Apr-2020 |
| 13 | +#date: 10-Sep-2020 |
14 | 14 | #bash version: 4.0 or higher |
15 | 15 | #credits: - |
16 | 16 | #license: MIT License |
17 | | -version=0.2.0 |
| 17 | +version=0.2.2 |
18 | 18 |
|
19 | 19 |
|
20 | 20 |
|
@@ -1678,6 +1678,43 @@ tasker_config_utils_generate_config_info() { |
1678 | 1678 | #if ascii_help_anchor is set |
1679 | 1679 | if [ ! -z "$ascii_help_anchor" ]; then |
1680 | 1680 |
|
| 1681 | + #if ascii_help_anchor contains a "Control" section |
| 1682 | + if [[ "$ascii_help_anchor" == *"Control:"* ]]; then |
| 1683 | + #extract the "Control" section from the tasks's help anchor |
| 1684 | + #Control section must be in the format: |
| 1685 | + ### |
| 1686 | + #Control: |
| 1687 | + #" |
| 1688 | + #control 1 |
| 1689 | + #control 2 |
| 1690 | + #" |
| 1691 | + # |
| 1692 | + # |
| 1693 | + ### |
| 1694 | + #use -E for extended regex, and -n to disable printing |
| 1695 | + #sed -nE '/^Control:$/' #match Control line |
| 1696 | + # { #if matched start a subscript |
| 1697 | + # :a; #create a label called a |
| 1698 | + # N; #add next line to pattern space |
| 1699 | + # #if pattern space does not end with "\n"\n\n$" go to label a; |
| 1700 | + # /\n"\n\n$/!ba |
| 1701 | + # #if pattern space matches "^Control:\n"(.*)\n"\n\n.*", then print matched group |
| 1702 | + # s/^Control:\n"(.*)\n"\n\n.*/\1/p; |
| 1703 | + # }' |
| 1704 | + ascii_task_control="$(echo "$ascii_help_anchor" | sed -nE '/^Control:$/{:a;N;/\n"\n\n[^\n]*$/!ba;s/^Control:\n"(.*)\n"\n\n.*/\1/p;}')" |
| 1705 | + return_value=$? |
| 1706 | + if [ $return_value -ne 0 ]; then |
| 1707 | + tasker_config_utils_log_errors "Failed to extract task control of task $task_id from exported_tasker_config" |
| 1708 | + return $return_value |
| 1709 | + fi |
| 1710 | + |
| 1711 | + #if ascii_task_control is set |
| 1712 | + if [ ! -z "$ascii_task_control" ]; then |
| 1713 | + ascii_task_control_code_block="$(convert_string_to_markdown_code "code-block" "$ascii_task_control")" |
| 1714 | + tasks_info_list+=$'\n**Control:**\n'"$ascii_task_control_code_block" |
| 1715 | + fi |
| 1716 | + fi |
| 1717 | + |
1681 | 1718 | #if ascii_help_anchor contains a "Comments" section |
1682 | 1719 | if [[ "$ascii_help_anchor" == *"Comments:"* ]]; then |
1683 | 1720 | #extract the "Comments" section from the tasks's help anchor |
@@ -2366,7 +2403,7 @@ Available command_options: |
2366 | 2403 | [ --post_tag=<tag> ] |
2367 | 2404 | optional post tag sed regex to match while extracting tag |
2368 | 2405 |
|
2369 | | -tasker_config should be the path to a Tasker \"Data Backup\" XML file. It passed must be an exported \ |
| 2406 | +tasker_config should be the path to a Tasker \"Data Backup\" XML file. It must be an exported \ |
2370 | 2407 | \"Data Backup\" and not an auto backup. |
2371 | 2408 |
|
2372 | 2409 | The options '-a', '-p', '-s', '-t' and '--node' set the extraction_node of the extract_tag command. \ |
@@ -2401,7 +2438,7 @@ Available command_options: |
2401 | 2438 | [ -v | -vv ] set verbose level to 1 or 2 |
2402 | 2439 |
|
2403 | 2440 |
|
2404 | | -tasker_config should be the path to a Tasker \"Data Backup\" XML file. It passed must be an exported \ |
| 2441 | +tasker_config should be the path to a Tasker \"Data Backup\" XML file. It must be an exported \ |
2405 | 2442 | \"Data Backup\" and not an auto backup. |
2406 | 2443 |
|
2407 | 2444 | current_exported_tasker_project should be the path to a Tasker exported \"Project\" XML file that needs to \ |
|
0 commit comments