Skip to content

--license doesn't change LICENSE file #287

@ara303

Description

@ara303

Bug Report

Describe the current, buggy behavior

The --license argument doesn't behave differently when given values other than the default, MIT.

I tried several license names using the keywords from this page. I wasn't sure what else to use.

I wish to license my WP package under LGPL-2.1, because granting maximum freedoms is important to me.

(I recognise this is a low priority issue. I personally feel it's important for the OSS ecosystem that licensing be respected properly.)

Describe how other contributors can replicate this bug

I ran both:

  • wp scaffold package <name> --license=GPL-2.0
  • wp scaffold package-readme <dir> --license=BSD

Mustache templating works, but I notice it appears hard-coded to only operate on the MIT license.

Describe what you would expect as the correct outcome

When including the --license=<license_tag> parameter, I expect the license to change in the LICENSE file.

Let us know what environment you are running this on

OS:     Linux 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025 x86_64
Shell:
PHP binary:     /usr/bin/php8.4
PHP version:    8.4.18
PHP memory limit:       -1
php.ini used:   /etc/php/8.4/cli/php.ini
MySQL binary:   /usr/bin/mariadb
MySQL version:  mariadb from 11.8.6-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using  EditLine wrapper
SQL modes:      STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       phar:///usr/local/bin/wp-cli
WP-CLI packages dir:    /home/pc/.wp-cli/packages/
WP-CLI cache dir:       /home/pc/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.13.0-alpha-fa5285f

Provide a possible solution

Two that I can think of, but I'm absolutely open to ideas and feedback. I would be delighted to contribute a PR to fix this issue myself!

  1. If the --license argument isn't intended to be any other than MIT (I note all wp-cli packages are MIT-licensed), the path of least resistance is to outright remove mention of --license.
  2. If this is intended to be used, it should be compared against a list of known licenses, error if an unknown one is given, but if a valid license name is given then that license's text should be parsed with Mustache and then overwrite the current LICENSE text. I note Choosealicense.com (a GitHub-maintained repo) which could be used as a basis to expand the current templating.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions