luckyframework / luckyframework/lucky

Action generator that accepts http method and path`

Open
#1,098 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request hacktoberfest
Dominant language
Crystal
Stars
2.7k
Forks
172
PR merge metrics
No merged PRs in 30d

Description

The current generator only allows for RESTful actions. Providing something else will throw an error:

```
❯ lucky gen.action.browser Members::Dashboard
Could not infer route for Members::Dashboard

Got:
Members::Dashboard (missing a known resourceful action)

Expected something like:
Users::Index # Index, Show, New, Create, Edit, Update, or Delete
```

We should add an option to specify the HTTP method and path. If you provide a RESTful action, then it will still infer.

```
lucky gen.action.browser Messages::Archive get /message/:message_id/archive
```

would generate `Messages::Archive` class with `get "/messages/:message_id/archive"`. When no path and HTTP method are provided, it would still show the error when it can't infer.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the implementation behind `lucky gen.action.browser`, especially how it parses the action argument and infers RESTful routes. Check how the generator reports an unknown action, then support the optional HTTP method and path shown in the issue while preserving inference and the existing error when they are absent. Done means the example generates the requested class and route, while RESTful actions continue to infer routes.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.