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

Accept to pass compiler options to crystal docs #3622

Conversation

makenowjust
Copy link
Contributor

crystal docs dose not build a program, however it uses the compiler. So, crystal docs should be accepted compiler options.

opts.on("--release", "Compile in release mode") do
compiler.release = true
end
opts.on("-s", "--stats", "Enable statistics output") do
Copy link
Contributor

Choose a reason for hiding this comment

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

Stats for docs should be possible I think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above. In usual compiler option, --stat dose not appear if it is not code generation command.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Although, stats for docs is possible, just you say. I'll try to add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But all no code generation command stats is not available, so this code is right.

@asterite
Copy link
Member

asterite commented Dec 3, 2016

I agree, crystal docs should probably have compiler options, but with this PR you can just do -h, -D (probably not very helpful here) and --error-trace, which isn't very helpful. I'd like to merge this once we have some options that add value to the command.

@makenowjust
Copy link
Contributor Author

@asterite yes, --error-trace isn't very helpful. So, it may be mistake to use Crystal#setup_simple_compiler_options for crystal docs.

@makenowjust makenowjust force-pushed the feature/crystal-docs-accepts-compiler-option branch from afef168 to ff64a7b Compare December 5, 2016 14:16
private def setup_simple_compiler_options(compiler, opts)
opts.on("-d", "--debug", "Add symbolic debug info") do
compiler.debug = true
private def setup_simple_compiler_options(compiler, opts, no_codegen = false)
Copy link
Member

Choose a reason for hiding this comment

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

The flag should better be named positively: codegen = true. This resolves the double negation from unless no_codegen to if codegen.

opts.on("-h", "--help", "Show this message") do
puts opts
exit
end
unless no_codegen
Copy link
Member

Choose a reason for hiding this comment

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

These flags should still be above --help which is supposed to be the last item.

@asterite
Copy link
Member

@makenowjust It seems this can now be implemented with setup_simple_compiler_options, which was introduced some time ago. Would you like to do that and send a new PR?

@asterite asterite closed this Apr 27, 2018
@straight-shoota
Copy link
Member

As there is no issue for this, it would probably be better to leave this PR open until there is a successor. Otherwise the improvement might get lost...

@asterite asterite reopened this Apr 28, 2018
@asterite
Copy link
Member

Thinking a bit more about this, I'm not sure what options would be valuable for the docs command. Maybe -D some_flag if you wanted the docs to be generated in some way... (but then users using that API will have to pass -D some_flag too...)

@miketheman
Copy link
Contributor

#codetriage
This patch is no longer mergable, and it's unclear what direction this ought to take.
A better interface to the compiler has been implemented since it started, and it's unclear what benefit having compiler options are to the docs command are.

If there's no real benefit, I'd recommend closing this PR.

@straight-shoota
Copy link
Member

Compiler options have been added in #6668. Thanks anyway, @makenowjust 👍

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.

None yet

5 participants