You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function initializes the script environment and provides access to a series of utility commands designed to assist in handling and transforming workflow logs.
25
+
26
+
Available Commands:
27
+
- \[init648]: Initializes the necessary environment settings for script execution. Use this before running other related functions to ensure all configurations are correctly set.
28
+
- \[description]: Provides a comprehensive explanation of the workflow processing, detailing each step and its purpose within the system.
29
+
- \[makeParse]: Executes the log parsing process, transforming verbose workflow logs into a structured JSON format, facilitating easier data manipulation and analysis.
30
+
- \[makeDiffExample]: Demonstrates how to compare two JSON files derived from workflow logs, highlighting differences.
31
+
32
+
Usage:
33
+
To learn more about each command, type the command followed by 'help'. This will display detailed information about the command's function and usage examples.
34
+
35
+
Example:
36
+
\$ init648 help # Displays help information for the init648 command.
37
+
38
+
Note: Tests were conducted in the directory:
39
+
HELP_USAGE
40
+
}
41
+
42
+
description() {
43
+
cat <<HELP_USAGE | helpCat0 bash
44
+
Description:
45
+
This script parses 'workflowconfig.log' files, which contain lines of commands complete with switches and configuration settings. It is designed to transform these log entries into a structured JSON format, making the data easier to manipulate and read.
46
+
47
+
Purpose:
48
+
- To convert workflow configuration logs into a JSON structure where each command, along with its switches and key values, is represented as an object within an array. This facilitates easier data manipulation and readability.
49
+
50
+
Structure of Log Entries:
51
+
- Each line in the log file represents a single command with its options, structured as follows:
52
+
<commandName> <switches> --configKeyValues
53
+
54
+
Example Command:
55
+
A typical command in the log might appear like this:
This script processes each command line from the log, turning them into JSON objects. This structural change not only organizes the data but also enhances accessibility for programmatic queries and analysis.
60
+
HELP_USAGE
61
+
}
62
+
63
+
64
+
makeParse() {
65
+
# Use heredoc to send help text through helpCat alias, which will apply syntax highlighting if pygmentize is available.
66
+
if [[ -z"$1" ]];then
67
+
# Use heredoc to send help text through helpCat alias, which will apply syntax highlighting if pygmentize is available.
68
+
cat <<'HELP_USAGE' | helpCat0 bash
69
+
makeParse: Parse the workflow log and create an output.json file.
70
+
Usage:
71
+
makeParse <workflowconfig.log>
72
+
73
+
Example usage:
74
+
#makeParse workflowconfig.log > ~/output.json # To parse a specific log file.
This function provides examples of how to parse workflow configuration logs into JSON format and then compare these JSON files using \`diff\`. The comparison can be done directly using \`jq\` to filter and sort the JSON data, which helps in identifying the differences more clearly.
118
+
119
+
Examples:
120
+
121
+
1. Parse workflow configuration logs into JSON format:
0 commit comments