private function get_packages()
    {
        if ($this->input->getOption('all') === true) {
            $packages = [];
            
            // Add all package files to $packages array.
            foreach (Config::get('services.providers') as $package) {
                $packages[ $package ] = $package::get_files_to_publish();
            }

            return $packages;
        }

        $package = $this->input->getOption('package');

        // If no package specified.
        if ($package === null) {
            $package = $this->package_prompt();
        }

        // If the package chosen does not exist.
        if (! \class_exists($package)) {
            $this->output->writeln("<error>The package [$package] could not be found.</error>");
            exit;
        }

        // When running publish via the theme installer, the current theme isn't active yet.
        // We need to trick WP into thinking it is.
        if (isset($this->root)) {
            $parts = \explode('/', $this->root);

            if ($parts[0] == $this->root) {
                $parts = \explode('\\', $this->root);
            }

            $theme_name = \end($parts);

            \add_filter(
                'stylesheet',
                function () use ($theme_name) {
                    return $theme_name;
                }
            );
            \add_filter(
                'template',
                function () use ($theme_name) {
                    return $theme_name;
                }
            );

            // Resolve the package manually.
            $provider = Container::resolve($package);
            $provider->register();
        }

        return [
            $package => $package::get_files_to_publish(),
        ];
    }