Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OptionParser for the lucky CLI #771

Merged
merged 4 commits into from
May 13, 2023
Merged

Use OptionParser for the lucky CLI #771

merged 4 commits into from
May 13, 2023

Conversation

jwoertink
Copy link
Member

@jwoertink jwoertink commented Aug 1, 2022

Fixes #724

This changes the interface of how the lucky CLI works. When you install the lucky CLI, you'll now be able to run standard -h and -v commands without having to wait for compilation. The only time the compiler kicks on is when you run the new lucky tasks command.

This also changes up what commands are displayed based on if you're inside of an app or not. You wouldn't want to run lucky init while inside of an app, and you can't really run lucky dev outside of an app...

When outside of a Lucky app

❯ ./bin/lucky -h
Usage: lucky [command]
    init                             Start the Lucky wizard
    init.custom                      Generate a new Lucky application
    -v, --version                    Show the version of the LuckyCLI
    -h, --help                       Show this help

❯ ./bin/lucky -v
1.0.0

When inside a Lucky app

❯ /home/jeremy/Development/lucky_org/lucky_cli/bin/lucky -h
Usage: lucky [command]
    dev                              Boot the lucky development server
    tasks                            Display a list of the tasks available in your app
    -v, --version                    Show the version of the LuckyCLI
    -h, --help                       Show this help

❯ /home/jeremy/Development/lucky_org/lucky_cli/bin/lucky -v
1.0.0

❯ /home/jeremy/Development/lucky_org/lucky_cli/bin/lucky dev -h
Usage: lucky dev

Boot your Lucky application. Uses the Procfile.dev to
run each service. Edit this file to change which services
are booted.

❯ /home/jeremy/Development/lucky_org/lucky_cli/bin/lucky tasks -h
Usage: lucky tasks

Run this from within your Lucky application directory.
This will compile a list of all the available tasks in your
application.

To compile your tasks, build the tasks.cr file
> crystal build tasks.cr -o bin/tasks

❯ /home/jeremy/Development/lucky_org/lucky_cli/bin/lucky tasks
Usage: lucky name.of.task [options]

Available tasks:

  ▸ db.console                    Access PostgreSQL console
  ▸ db.create                     Create the database
  ▸ db.drop                       Drop the database

I'm not sure if you'd consider this a "breaking" change or not... It is a different interface, but you don't lose any functionality. Just changes the command used to see your list of tasks to lucky tasks.

@jwoertink jwoertink marked this pull request as ready for review May 7, 2023 00:33
…app directory. Now shows the correct commands
@jwoertink jwoertink merged commit 5d9ddb9 into main May 13, 2023
4 of 6 checks passed
@jwoertink jwoertink deleted the issues/724 branch May 13, 2023 01:01
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.

Lucky dev isn't shown in lucky -h
2 participants