public function serialize()
    {
        $args = join(' ', $this->args);

        // nargs must be last and only 1

        $options = [];
        $narg = null;
        foreach ($this->options as $option => $value) {
            if (is_array($value)) {
                $narg = "$option ".join(' ', array_map('strval', $value));
                continue;
            }

            if (is_numeric($option)) {
                $options[] = strval($value);
            } elseif (is_bool($value)) {
                $options[] = $option;
            } else {
                $options[] = trim("$option $value");
            }
        }

        if (!is_null($narg)) {
            array_push($options, $narg);
        }

        return trim(preg_replace('/[\s]{2,}/', ' ', "{$this->binary} $args ".join(' ', $options)) ?: '');
    }