sunbeam icon indicating copy to clipboard operation
sunbeam copied to clipboard

In TTY mode prevent screen refreshes after completion of run action

Open smetroid opened this issue 1 year ago • 1 comments

When using TTY mode, is it possible to not refresh the Sunbeam screen when the command succeeds?

I have an Ansible playbook I am running and if there are some errors in the playbook I would like the sunbeam screen not to refresh so I have a chance to view the results.

https://github.com/smetroid/sunbeam-extensions/blob/main/ansible-playbooks.sh

if [ "$COMMAND" = "ansible-options" ]; then
    echo $OPTIONS | jq '{
            "items": map({
            "title": .,
            "subtitle": (" ... run "+ (. | split("-")[1]) +  " roles on a " + (. | split("-")[0]) + " localhost"),
                "actions": [
                    {
                        "type": "run",
                        "title": ("Run Ansible Playbook for " + .),
                        "command": "run-ansible",
                        "params": {
                            "os": . | split("-")[0],
                            role: . | split("-")[1],
                        },
                        reload: false
                    }
                ]
            })
        }'
        exit 0
fi

I thought the reload option set to false would allow me to do this, but it doesn't appear to work as I thought it would.

smetroid avatar Feb 19 '24 17:02 smetroid

Interesting point. I could maybe capture stderr, and show it in the error page

pomdtr avatar Feb 23 '24 00:02 pomdtr