#!/usr/bin/python3 -s
import shlex
import subprocess
from l3tlib.command import L3tIncidentCommand
from l3tlib.template import format


class Open(L3tIncidentCommand):

    descr = "Opens a support request using xdg-open"

    def run(self):
        incident = self.l3t.get_incident(self.opts.incident, self.opts.bug,
                                         status=True, slow=True)
        raw_cmd = format(self.config.l3t.sr_open_command, sr=incident.sr.id)
        args = shlex.split(raw_cmd)
        subprocess.call(args)


Open().main()
