luckyframework / luckyframework/lucky_cli
lucky routes command does not work without any first argument
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 92
- Forks
- 48
- PR merge metrics
- No merged PRs in 30d
Description
It causes periodically when works with cli commands:
```
roquie:test-lucky$ lucky gen.model VatNumberType
Created CreateVatNumberTypes::V20200919094107 in ./db/migrations/20200919094107_create_vat_number_types.cr
Generated VatNumberType in ./src/models/vat_number_type.cr
Generated VatNumberTypeOperation in ./src/operations/save_vat_number_type.cr
Generated VatNumberTypeQuery in ./src/queries/vat_number_type_query.cr
roquie:test-lucky$ lucky routes
Showing last frame. Use --error-trace for full trace.
Unhandled exception: Negative argument (ArgumentError)
from raise:NoReturn
from String#*:String
from Crystal::TypeException+@Crystal::ErrorFormat#append_error_indicator:(String::Builder | Nil)
from Crystal::TypeException+@Crystal::ErrorFormat#error_body:(String | Nil)
from Crystal::TypeException+@Crystal::TypeException#append_to_s:(IO::FileDescriptor | Nil)
from Crystal::Command#run:(Bool | Nil)
from __crystal_main
from main
roquie:test-lucky$ lucky get.action.api
Showing last frame. Use --error-trace for full trace.
Unhandled exception: Negative argument (ArgumentError)
from raise:NoReturn
from String#*:String
from Crystal::TypeException+@Crystal::ErrorFormat#append_error_indicator:(String::Builder | Nil)
from Crystal::TypeException+@Crystal::ErrorFormat#error_body:(String | Nil)
from Crystal::TypeException+@Crystal::TypeException#append_to_s:(IO::FileDescriptor | Nil)
from Crystal::Command#run:(Bool | Nil)
from __crystal_main
from main
roquie:test-lucky$ lucky routes --help
Showing last frame. Use --error-trace for full trace.
Unhandled exception: Negative argument (ArgumentError)
from raise:NoReturn
from String#*:String
from Crystal::TypeException+@Crystal::ErrorFormat#append_error_indicator:(String::Builder | Nil)
from Crystal::TypeException+@Crystal::ErrorFormat#error_body:(String | Nil)
from Crystal::TypeException+@Crystal::TypeException#append_to_s:(IO::FileDescriptor | Nil)
from Crystal::Command#run:(Bool | Nil)
from __crystal_main
from main
roquie:test-lucky$ lucky get.action.api -h
Showing last frame. Use --error-trace for full trace.
Unhandled exception: Negative argument (ArgumentError)
from raise:NoReturn
from String#*:String
from Crystal::TypeException+@Crystal::ErrorFormat#append_error_indicator:(String::Builder | Nil)
from Crystal::TypeException+@Crystal::ErrorFormat#error_body:(String | Nil)
from Crystal::TypeException+@Crystal::TypeException#append_to_s:(IO::FileDescriptor | Nil)
from Crystal::Command#run:(Bool | Nil)
from __crystal_main
from main
roquie:test-lucky$ lucky db.migrate
Showing last frame. Use --error-trace for full trace.
Unhandled exception: Negative argument (ArgumentError)
from raise:NoReturn
from String#*:String
from Crystal::TypeException+@Crystal::ErrorFormat#append_error_indicator:(String::Builder | Nil)
from Crystal::TypeException+@Crystal::ErrorFormat#error_body:(String | Nil)
from Crystal::TypeException+@Crystal::TypeException#append_to_s:(IO::FileDescriptor | Nil)
from Crystal::Command#run:(Bool | Nil)
from __crystal_main
from main
roquie:test-lucky$ lucky get.action.api -h
Showing last frame. Use --error-trace for full trace.
Unhandled exception: Negative argument (ArgumentError)
from raise:NoReturn
from String#*:String
from Crystal::TypeException+@Crystal::ErrorFormat#append_error_indicator:(String::Builder | Nil)
from Crystal::TypeException+@Crystal::ErrorFormat#error_body:(String | Nil)
from Crystal::TypeException+@Crystal::TypeException#append_to_s:(IO::FileDescriptor | Nil)
from Crystal::Command#run:(Bool | Nil)
from __crystal_main
from main
roquie:test-lucky$ lucky get.action.api -h
Showing last frame. Use --error-trace for full trace.
Unhandled exception: Negative argument (ArgumentError)
from raise:NoReturn
from String#*:String
from Crystal::TypeException+@Crystal::ErrorFormat#append_error_indicator:(String::Builder | Nil)
from Crystal::TypeException+@Crystal::ErrorFormat#error_body:(String | Nil)
from Crystal::TypeException+@Crystal::TypeException#append_to_s:(IO::FileDescriptor | Nil)
from Crystal::Command#run:(Bool | Nil)
from __crystal_main
from main
roquie:test-lucky$ lucky gen.model -h
Generate a model, query, and save operation
Example:
lucky gen.model Project title:String description:String? completed:Bool priority:Int32
roquie:test-lucky$ lucky routes -h
Showing last frame. Use --error-trace for full trace.
Unhandled exception: Negative argument (ArgumentError)
from raise:NoReturn
from String#*:String
from Crystal::TypeException+@Crystal::ErrorFormat#append_error_indicator:(String::Builder | Nil)
from Crystal::TypeException+@Crystal::ErrorFormat#error_body:(String | Nil)
from Crystal::TypeException+@Crystal::TypeException#append_to_s:(IO::FileDescriptor | Nil)
from Crystal::Command#run:(Bool | Nil)
from __crystal_main
from main
roquie:test-lucky$ lucky routes asd
Routing documentation:
https://luckyframework.org/guides/http-and-routing/routing-and-params
GET /api/me ▸ Api::Me::Show
POST /api/sign_ins ▸ Api::SignIns::Create
POST /api/sign_ups ▸ Api::SignUps::Create
GET / ▸ Home::Index
roquie:test-lucky$ lucky routes asd -h
Show all the routes for the app
Run this task with 'lucky routes'
roquie:test-lucky$ lucky routes asd
Routing documentation:
https://luckyframework.org/guides/http-and-routing/routing-and-params
GET /api/me ▸ Api::Me::Show
POST /api/sign_ins ▸ Api::SignIns::Create
POST /api/sign_ups ▸ Api::SignUps::Create
GET / ▸ Home::Index
roquie:test-lucky$ lucky routes --trac
Compiling... ⣽ ^C
roquie:test-lucky$ lucky routes --trace | pbcopy # <---------- In this place I think what I should was be create an issue at Github and trying to get a full trace log for you :))
Unhandled exception: Invalid option: --trace (OptionParser::InvalidOption)
from ../../../../../../../usr/local/Cellar/crystal/0.35.1_1/src/option_parser.cr:129:45 in '->'
from ../../../../../../../usr/local/Cellar/crystal/0.35.1_1/src/primitives.cr:255:3 in 'parse'
from lib/lucky/tasks/routes.cr:4:1 in 'print_help_or_call'
from lib/lucky_cli/src/lucky_cli/runner.cr:27:9 in 'run'
from tasks.cr:20:1 in '__crystal_main'
from ../../../../../../../usr/local/Cellar/crystal/0.35.1_1/src/crystal/main.cr:105:5 in 'main_user_code'
from ../../../../../../../usr/local/Cellar/crystal/0.35.1_1/src/crystal/main.cr:91:7 in 'main'
from ../../../../../../../usr/local/Cellar/crystal/0.35.1_1/src/crystal/main.cr:114:3 in 'main'
roquie:test-lucky$ lucky routes
Routing documentation:
https://luckyframework.org/guides/http-and-routing/routing-and-params
GET /api/me ▸ Api::Me::Show
POST /api/sign_ins ▸ Api::SignIns::Create
POST /api/sign_ups ▸ Api::SignUps::Create
GET / ▸ Home::Index
roquie:test-lucky$ lucky routes
Routing documentation:
https://luckyframework.org/guides/http-and-routing/routing-and-params
GET /api/me ▸ Api::Me::Show
POST /api/sign_ins ▸ Api::SignIns::Create
POST /api/sign_ups ▸ Api::SignUps::Create
GET / ▸ Home::Index
roquie:test-lucky$ lucky gen.model -h
Generate a model, query, and save operation
Example:
lucky gen.model Project title:String description:String? completed:Bool priority:Int32
roquie:test-lucky$
roquie:test-lucky$
roquie:test-lucky$ lucky db.migrate
Migrated CreateVatNumberTypes::V20200919094107
roquie:test-lucky$ lucky get.action.api -h
Task get.action.api not found. Did you mean 'gen.action.api'?
roquie:test-lucky$ lucky gen.action.api -h
Generate a new api action
Example:
lucky gen.action.api Api::Users::Index
roquie:test-lucky$ lucky gen.action.api Api::VatNumberTypes::Index
Done generating Api::VatNumberTypes::Index in ./src/actions/api/vat_number_types
roquie:test-lucky$ lucky routes
Showing last frame. Use --error-trace for full trace.
Unhandled exception: Negative argument (ArgumentError)
from raise:NoReturn
from String#*:String
from Crystal::TypeException+@Crystal::ErrorFormat#append_error_indicator:(String::Builder | Nil)
from Crystal::TypeException+@Crystal::ErrorFormat#error_body:(String | Nil)
from Crystal::TypeException+@Crystal::TypeException#append_to_s:(IO::FileDescriptor | Nil)
from Crystal::Command#run:(Bool | Nil)
from __crystal_main
from main
roquie:test-lucky$ lucky routes --error-trace
Showing last frame. Use --error-trace for full trace.
Unhandled exception: Negative argument (ArgumentError)
from raise:NoReturn
from String#*:String
from Crystal::TypeException+@Crystal::ErrorFormat#append_error_indicator:(String::Builder | Nil)
from Crystal::TypeException+@Crystal::ErrorFormat#error_body:(String | Nil)
from Crystal::TypeException+@Crystal::TypeException#append_to_s:(IO::FileDescriptor | Nil)
from Crystal::Command#run:(Bool | Nil)
from __crystal_main
from main
roquie:test-lucky$
# But flag `--error-trace` not showing more than default output.
```
I just use the tool like in docs and it behavior is so strange. I think is a little bug :)
```text
CRYSTAL_CACHE_DIR=/Users/roquie/.cache/crystal
CRYSTAL_PATH=lib:/usr/local/Cellar/crystal/0.35.1_1/src
CRYSTAL_VERSION=0.35.1
CRYSTAL_LIBRARY_PATH=/usr/local/Cellar/crystal/0.35.1_1/embedded/lib:/usr/local/lib
CRYSTAL_OPTS=''
```
MacOS Catalina 10.15.6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with `lucky routes` and `lucky routes --help`, then read `lib/lucky/tasks/routes.cr` and the command flow in `lib/lucky_cli/src/lucky_cli/runner.cr`. Confirm that routes and its help output work without a positional argument and that the reported Negative argument error is no longer produced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100