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

Dev-only CLI #2378

Merged
merged 1 commit into from
Feb 7, 2024
Merged

Dev-only CLI #2378

merged 1 commit into from
Feb 7, 2024

Conversation

kddnewton
Copy link
Collaborator

We keep adding more scripts to /bin that are doing the same kinds of processing. Instead, this commit consolidates them all into a single CLI that shares the same logic so that we can consistently read files in the same way.

It keeps around 2 binstubs for bin/lex and bin/parse since those are the most used and I'm sure people have built up muscle memory for those. Those scripts are now just wrappers for forwarding to bin/prism.

We keep adding more scripts to /bin that are doing the same kinds
of processing. Instead, this commit consolidates them all into a
single CLI that shares the same logic so that we can consistently
read files in the same way.

It keeps around 2 binstubs for bin/lex and bin/parse since those
are the most used and I'm sure people have built up muscle memory
for those. Those scripts are now just wrappers for forwarding to
bin/prism.
@noahgibbs
Copy link
Contributor

Seems like a good idea.

@kddnewton kddnewton merged commit e9152e5 into main Feb 7, 2024
55 checks passed
@kddnewton kddnewton deleted the cli branch February 7, 2024 21:26
@enebo
Copy link
Collaborator

enebo commented Feb 8, 2024

@kddnewton Is there a possibility of us making a non-dev script so we can run and generate AST, etc... from the installed gem?

@kddnewton
Copy link
Collaborator Author

Yeah we could do that. I don't think CRuby will want us to ship that with it so we'll need to take a little care to make sure it doesn't get copied over, but that's doable. Could you open an issue for it?

@enebo
Copy link
Collaborator

enebo commented Feb 8, 2024

@kddnewton yeah I only want it so I can trivially display AST without needing to bust back to dev env. Not sure on whether other tools will be useful but it is nice to display AST when debugging runtime issues.

@enebo
Copy link
Collaborator

enebo commented Feb 8, 2024

@noahgibbs I added jruby/jruby#8094 for that newly discovered ripper issue.

@kddnewton
Copy link
Collaborator Author

@enebo if you have CRuby 3.3, you can run ruby --dump=prism -e 'whatever' and you'll get the AST.

@enebo
Copy link
Collaborator

enebo commented Feb 9, 2024

@kddnewton Yeah that works for MRI for sure. I have thought about adding similar thing to JRuby but have a bin/ast (which only currently works for legacy parser).

@eregon
Copy link
Member

eregon commented Feb 12, 2024

It'd be quite convenient to have an executable, because that would then use the installed gem vs the version used in CRuby at CRuby build time.
I think it would make sense to add a prism or so executable to CRuby too, because it does ship Prism as a default gem so it should be consistent (it's same for e.g. rdoc).

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.

4 participants