mirrored 16 minutes ago
0
TimothyxxxFix errors found in the examples (some broken links caused by Google Drive; dbus conflict) 09ffcc8
{
    "id": "f7dfbef3-7697-431c-883a-db8583a4e4f9",
    "snapshot": "libreoffice_writer",
    "instruction": "Could you convert all `.doc` files in current directory to PDF all at once in the command line?",
    "source": "https://www.thegeekdiary.com/libreoffice-command-examples-in-linux/",
    "config": [
        {
            "type": "download",
            "parameters": {
              "files": [
                {
                  "url": "https://drive.usercontent.google.com/download?id=1efUzatD7vixloPY9-XENOL3OZ5__1hod&export=download&authuser=0&confirm=t&uuid=14a3a6b1-a6e2-46cf-9e5b-bcc9e2acbc98&at=APZUnTWtyQUzT6eO5ZTcnmAZkwyX:1706704733958",
                  "path": "/home/user/Desktop/doc.tar.gz"
                }
              ]
            }
        },
        {
            "type": "execute",
            "parameters": {
                "command": [
                    "/bin/bash",
                    "-c",
                    "tar -zxf /home/user/Desktop/doc.tar.gz -C /home/user/Desktop/ && rm /home/user/Desktop/doc.tar.gz"
                ]
            }
        },
        {
            "type": "execute",
            "parameters": {
                "command": [
                    "/bin/bash",
                    "-c",
                    "history -c && echo > ~/.bash_history && sleep 3"
                ]
            }
        },
        {
            "type": "execute",
            "parameters": {
                "command": "export DBUS_SESSION_BUS_ADDRESS='unix:path=/run/user/1000/bus'\ngnome-terminal --maximize --working-directory=/home/user/Desktop",
                "shell": true
            }
        }
    ],
    "trajectory": "trajectories/",
    "related_apps": [
        "libreoffice_writer",
        "terminal"
    ],
    "evaluator": {
        "postconfig": [
            {
                "type": "execute",
                "parameters": {
                    "command": [
                        "/bin/bash",
                        "-c",
                        "cd /home/user/Desktop && tar -zcf pdf.tar.gz *.pdf"
                    ]
                }
            },
            {
              "type": "execute",
              "parameters": {
                "command": [
                    "/bin/bash",
                    "-c",
                    "killall gnome-terminal-server"
                ]
              }
            }
        ],
        "func": [
            "check_include_exclude",
            "compare_archive"
        ],
        "result": [
            {
                "type": "vm_command_line",
                "command": [
                    "/bin/bash",
                    "-c",
                    "output=$(cat ~/.bash_history | grep -E \"(soffice|libreoffice).+--convert-to\\s+pdf.+\\*\\.doc\"); if [ -z \"$output\" ]; then echo \"failed to complete this task\"; else echo \"catch the desired command\"; fi"
                ]
            },
            {
                "type": "vm_file",
                "path": "/home/user/Desktop/pdf.tar.gz",
                "dest": "pdf.tar.gz"
            }
        ],
        "expected": [
            {
                "type": "rule",
                "rules": {
                    "include": [
                        "catch the desired command"
                    ],
                    "exclude": [
                        "failed to complete this task"
                    ]
                }
            },
            {
                "type": "cloud_file",
                "path": "https://drive.usercontent.google.com/download?id=1A-UoQdQvvtFBQWkPi_Q8ecNe4gjlh0dg&export=download&authuser=0&confirm=t&uuid=0c97e2f6-3de8-438f-a676-557cca5ee292&at=APZUnTUy4pghj5TtS-suVMXrCLO2:1706705033330",
                "dest": "pdf_gold.tar.gz"
            }
        ],
        "options": [
            {},
            {
                "file_type": "pdf"
            }
        ]
    }
}