f3d icon indicating copy to clipboard operation
f3d copied to clipboard

`--dry-run` option is not working

Open mwestphal opened this issue 1 year ago • 8 comments

Describe the bug F3D usually uses a config file, but there is an option to disable this behavior, --dry-run. It seems to be non-functionnal currently

To Reproduce Steps to reproduce the behavior, using a built f3d with BUILD_TESTING enabled:

  1. Open the file using `f3d --config=config_build --dry-run --verbose
  2. F3D appears with axis visible, it should not
  3. Check the output, a config file is read

Expected behavior Config file should not be read

Additional context in F3DStarter.cxx:655, although the comment says that dry-run is being checked, its actually not. Add the check here by checking the cli option and position the boolean accordingly. Also add a test for it in application/testing/CMakeLists.txt

mwestphal avatar Sep 27 '24 19:09 mwestphal

Would this be the right time to rename this argument to --no-config or something? --dry-run is used in many CLI applications to mean "run as normal but don't actually write/change anything" so it's a bit confusing (F3D's --no-render is closer to what --dry-run usually means)

snoyer avatar Sep 28 '24 06:09 snoyer

Good point @snoyer

mwestphal avatar Sep 28 '24 09:09 mwestphal

Is this issue still open? If it is I would like to work on it.

Yogesh9000 avatar Oct 03 '24 18:10 Yogesh9000

It is open!

mwestphal avatar Oct 04 '24 06:10 mwestphal

Hum, since you are working on another issue, I'd like to keep this one open for other developpers with no experience on the project if thats ok

mwestphal avatar Oct 04 '24 06:10 mwestphal

sure thats fine

Yogesh9000 avatar Oct 04 '24 14:10 Yogesh9000

Hey there, this looks interesting, if no one else is working on it, can i pick it up? Thank you so much! @mwestphal

rehanganapathy avatar Oct 06 '24 12:10 rehanganapathy

Sounds good! @rehanganapathy , go for it :)

mwestphal avatar Oct 06 '24 14:10 mwestphal

@rehanganapathy any news on this ?

mwestphal avatar Nov 01 '24 11:11 mwestphal

no feedback, unassigning it

mwestphal avatar Nov 05 '24 22:11 mwestphal

Hello!

With this patch, the config value is never set.

 application/F3DStarter.cxx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/application/F3DStarter.cxx b/application/F3DStarter.cxx
index e1cc563a..6b00c5bc 100644
--- a/application/F3DStarter.cxx
+++ b/application/F3DStarter.cxx
@@ -713,12 +713,16 @@ int F3DStarter::Start(int argc, char** argv)
   // but this duplicate the initialization value as it is present in
   // F3DOptionTools::DefaultAppOptions too
   bool dryRun = false;
+  if (cliOptionsDict.find("dry-run") != cliOptionsDict.end())
+  {
+    dryRun = f3d::options::parse<bool>(cliOptionsDict["dry-run"]);
+  }
   if (cliOptionsDict.find("no-render") != cliOptionsDict.end())
   {
     dryRun = f3d::options::parse<bool>(cliOptionsDict["no-render"]);
   }
   std::string config;
-  if (cliOptionsDict.find("config") != cliOptionsDict.end())
+  if (!dryRun && cliOptionsDict.find("config") != cliOptionsDict.end())
   {
     config = f3d::options::parse<std::string>(cliOptionsDict["config"]);
   }

Is it correct and/or a good starting point?

t-h2o avatar Nov 16 '24 01:11 t-h2o

It is definitely a good starting point! Do you want to open a PR with this patch @t-h2o ?

mwestphal avatar Nov 16 '24 09:11 mwestphal

It is definitely a good starting point! Do you want to open a PR with this patch @t-h2o ?

Done: https://github.com/f3d-app/f3d/pull/1720

t-h2o avatar Nov 17 '24 21:11 t-h2o

That's me, vincenzo. i am getting this issue

voidrc avatar Dec 17 '24 08:12 voidrc

Sorry, this issue is not available

mwestphal avatar Dec 17 '24 11:12 mwestphal

That's me, vincenzo. i am getting this issue

You can review the current PR on this issue https://github.com/f3d-app/f3d/pull/1720 if you want

t-h2o avatar Dec 17 '24 11:12 t-h2o

FIxed by #1720

mwestphal avatar Dec 26 '24 15:12 mwestphal