premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.13k stars 611 forks source link

Command line arguments? #2173

Closed crazydef closed 6 months ago

crazydef commented 6 months ago

What's your question? Is there a reference page detailing all the standard command line arguments for Premake?

https://premake.github.io/docs/Command-Line-Arguments only explains how to create new ones.

premake5 --help just throws an error.

Jarod42 commented 6 months ago

premake5 --help should do the job... But if you have an "invalid" premake5.lua, error might happen (See https://github.com/premake/premake-core/issues/1967).

I recommend to have

if (_ACTION == nil) then
    return
end

at the beginning of the script, after potential newaction/newoption to reduce possible errors.

crazydef commented 6 months ago

I didn't have any premake5.lua file in the directory where I was running it. I just wanted to check the command line args to confirm my suspicions about a different script I was looking at.

nickclark2016 commented 6 months ago

Can you confirm what version of premake you are using and the operating system? Running 5.0.0-beta2 from a folder without premake files on Windows 11, I am not able to reproduce.

crazydef commented 6 months ago

Hmm, I just tried again and it also works for me now. (On Linux.) Not sure how I managed to break it earlier.

But well, it's clearly not a problem. Sorry for the confusion. :)

nickclark2016 commented 6 months ago

No worries!

crazydef commented 6 months ago

Follow up question: If I have a working premake5.lua file that loads extension modules, will the help text be updated with new options and parameters added by an extension?

(I.e., can I use premake5 --help to confirm that a module is being loaded correctly?)

Jarod42 commented 6 months ago

Yes (as long as newaction/newoption is called). but as I said previously, script should be valid. I (wrongly) used to use _ACTION which is nil with --help, so dereferencing it might be problematic...