Skip to content

Commit ad51ec4

Browse files
Added Control section to output of generate_config_info command.
The `control` section should store information and settings like version number for task and possibly even the project if the main task of the project.
1 parent c559fe7 commit ad51ec4

File tree

2 files changed

+49
-5
lines changed

2 files changed

+49
-5
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ All notable changes to this project will be documented in this file.
2020
`-`
2121

2222

23+
## [0.2.2] - 2020-09-10
24+
25+
### Added
26+
- Added `Control` section to output of `generate_config_info` command.
27+
28+
2329
## [0.2.1] - 2020-05-20
2430

2531
### Changed
@@ -38,7 +44,8 @@ All notable changes to this project will be documented in this file.
3844
##
3945

4046

41-
[unreleased]: https://github.com/Taskomater/tasker_config_utils/compare/v0.2.1...HEAD
47+
[unreleased]: https://github.com/Taskomater/tasker_config_utils/compare/v0.2.2...HEAD
48+
[0.2.2]: https://github.com/Taskomater/tasker_config_utils/compare/v0.2.1...v0.2.2
4249
[0.2.1]: https://github.com/Taskomater/tasker_config_utils/compare/v0.2.0...v0.2.1
4350
[0.2.0]: https://github.com/Taskomater/tasker_config_utils/compare/v0.1.0...v0.2.0
4451
[0.1.0]: https://github.com/Taskomater/tasker_config_utils/releases/tag/v0.1.0

tasker_config_utils

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
#description: various tasker config utils
1111
#author: agnostic-apollo
1212
#usage: run "bash tasker_config_utils --help"
13-
#date: 13-Apr-2020
13+
#date: 10-Sep-2020
1414
#bash version: 4.0 or higher
1515
#credits: -
1616
#license: MIT License
17-
version=0.2.0
17+
version=0.2.2
1818

1919

2020

@@ -1678,6 +1678,43 @@ tasker_config_utils_generate_config_info() {
16781678
#if ascii_help_anchor is set
16791679
if [ ! -z "$ascii_help_anchor" ]; then
16801680

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+
16811718
#if ascii_help_anchor contains a "Comments" section
16821719
if [[ "$ascii_help_anchor" == *"Comments:"* ]]; then
16831720
#extract the "Comments" section from the tasks's help anchor
@@ -2366,7 +2403,7 @@ Available command_options:
23662403
[ --post_tag=<tag> ]
23672404
optional post tag sed regex to match while extracting tag
23682405
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 \
23702407
\"Data Backup\" and not an auto backup.
23712408
23722409
The options '-a', '-p', '-s', '-t' and '--node' set the extraction_node of the extract_tag command. \
@@ -2401,7 +2438,7 @@ Available command_options:
24012438
[ -v | -vv ] set verbose level to 1 or 2
24022439
24032440
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 \
24052442
\"Data Backup\" and not an auto backup.
24062443
24072444
current_exported_tasker_project should be the path to a Tasker exported \"Project\" XML file that needs to \

0 commit comments

Comments
 (0)