Skip to content

Conversation

cromedome
Copy link
Contributor

An upcoming version of Dancer2 will allow you to scaffold plugins and config readers in addition to applications. As they currently stand, the existing CLI options are only meaningful to applications. This slight change makes the same options more meaningful for all types of projects.

@cromedome cromedome added this to the Dancer2 2.0.0 milestone Aug 29, 2025
Copy link
Member

@bigpresh bigpresh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially a "breaking change" for anyone who's got used to using dancer2 gen -a MyName but I can see the logic behind it, and if we're going to make a change like that, a major milestone version is the time :)

I do wonder if we should continue to support the old form at least for now as an alternative, though? (Not sure how easily/possible that is via CLI::Osprey, not very familiar with it)

It'll want to be made clear in the changelog that dancer2 gen -a MyApp now needs to be dancer2 gen -n MyApp

If we're making a confusing/breaking change here, should we add an arg for what we're generating e.g. -t / -type with the default being app, so you could document dancer2 gen -t app -n MyApp (leaving the clear path open for future generation of other things e.g. dancer2 gen -t plugin -n MyPlugin)?

Or would dancer2 gen ... be for generating a new app, and have new "commands" for other stuff, like .e.g dancer2 gen-plugin -n MyPlugin ?

Possibly wants a little more thought here?

@cromedome
Copy link
Contributor Author

It is certainly ambiguous when you are generating a normal app!

Some examples of how other things may look with this PR:

dancer2 gen -n Foobar
dancer2 gen -n Dancer2-Plugin-Foobar -a plugin
dancer2 gen -n Dancer2-ConfigReader-Foobar -a config
dancer2 gen -n Dancer2-Template-Foobar -a template
dancer2 gen -n Dancer2-Session-Foobar -a session
dancer2 gen -n Foobaz -c -a htmxapp

I am not opposed to separate sub commands either! dancer2 gen-app, gen-plugin, etc. Since we have no other real subcommands to speak of, we could be a bit more brief even: dancer2 app -n Foobar, dancer2 plugin Dancer2-Plugin-Foobar, etc.

I stuck with skel because that is what we have always used. Type is not a bad option either :)

I don't think we settled anything here, but we have a better set of ideas now! What do you think?

@bigpresh
Copy link
Member

dancer2 gen -n Dancer2-Plugin-Foobar -a plugin

I'd be very wary of using -a there as the "type" of thing to generate, when we've just removed it from being used as the app name - I think dancer2 gen -n Dancer2-Plugin-Foobar -t plugin or dancer2 gen-plugin -n Dancer2-Plugin-Foobar or even just dancer2 plugin Dancer2-Plugin-Foobar (but see below) would be better.

Since we have no other real subcommands to speak of, we could be a bit more brief even: dancer2 app -n Foobar

Hmm, we could - but would that bite us in the ass in the future if we add commands to do other things - maybe some kind of automatic "upgrade" that knows how to skim through your app and replace a deprecated way of doing something with a new way? Or a packaging/deployment shortcut, or app launching shortcut, or DB schema management, or $harebrained_idea_here?

My gut feeling so far is separate subcommands (gen-app with gen being an alias, then gen-plugin, etc).

@cromedome
Copy link
Contributor Author

I'm good with this. I'll refactor the PR such that:

  • gen is an alias for gen-app
  • common code in gen-app is moved into Dancer2::CLI

And this way, dancer2 gen continues to function as is.

As we add new subcommands, these methods will be useful; there's no
further need for the gen subcommand to keep them to itself.
@cromedome
Copy link
Contributor Author

@bigpresh See the updated PR. I think this captures our discussion above.

Thanks!

Copy link
Contributor

@yanick yanick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks simple enough!

Copy link
Member

@bigpresh bigpresh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@cromedome cromedome merged commit 311965f into main Sep 8, 2025
18 checks passed
@cromedome cromedome deleted the cli/rename-args branch September 8, 2025 10:17
@cromedome
Copy link
Contributor Author

Merged, thank you!

cromedome added a commit that referenced this pull request Sep 15, 2025
    [ BUG FIXES ]
    * GH #1701: Split cookie values on & only (Yanick Champoux)

    [ ENHANCEMENTS ]
    * GH #530: Make data censoring configurable (Yanick Champoux, David
      Precious)
    * GH #850: Scaffold tutorial app; allow multiple apps to be scaffolded
      in core Dancer2 (Jason A. Crome)
    * GH #1512: Log hook entries as they are executed (Yanick Champoux)
    * GH #1615: Remove Dancer2::Template::Simple from Dancer2 core (Jason
      A. Crome)
    * PR #1637: New, extendable configuration system (Mikko Koivunalho)
    * GH #1723: Enable use of a different Template Toolkit base class
      (Andy Beverley)
    * PR #1727: Don't create CPAN package files when generating new apps
      (Jason A. Crome)
    * PR #1731: Retire Template::Tiny fork, use CPAN's (Jason A. Crome,
      Karen Etheridge, Damien Krotkine, Yanick Champoux)
    * PR #1736: Allow config system to bootstrap itself (Yanick Champoux)
    * GH #1737: Add on_hook_exception for errors during hook processing
      (Andy Beverley)
    * PR #1739: Add source to on_hook_exception (Andy Beverley)
    * PR #1742: Refactor CLI for future expansion (Jason A. Crome)

    [ DOCUMENTATION ]
    * GH #1342: Document skipping private methods in pod coverage tests
      (Jason A. Crome)
    * PR #1721: New Dancer2 docs, reorganization of all documentation;
      from TPRF grant (Jason A. Crome)
    * PR #1741: Cover items missed in earlier documentation branch (Jason
      A. Crome)

    [ DEPRECATED ]
    * None

    [ MISC ]
    * None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants