'no such file' errors with ArgumentParser package

OK, but then I get an error because obviously it doesn't like "pdfutil.main()" at the very end of the code. How do I call the code instead? If I delete that altogether, then I get an error from the "Tests" code, (which I didn't write!).

Even so: my original project works perfectly; it just doesn't embed the package inside itself.

With this alternative version, it looks like I still have loads more work to do, to create a CLI tool executable.

Surely, getting a package to be a part of the project it's added to should be a very simple thing?

You don't have to call it yourself, the main() function is called automatically on a type that has @main attribute. You'll have to update tests to reflect that though.

This is only one-off setup work, but as a benefit you can port your tool to other platforms like Linux and Windows much more easily.

Have you followed the steps provided in the Adding package dependencies to your app article? In my understanding, that caused dyld errors you've shared in your original post, but I've never seen those before. It's hard for me to diagnose these errors without additional information and reproduction steps, ideally with a self-contained project setup if you can share that.

Thank you for your help with this. Sorry it's been so lengthy.

I supposed we should have started with this. Here's the original project.

The tools uses lots of MacOS graphics APIs, so unlikely to work on Linux or Windows.

I don't mean to claim any credit for helping you with this, but I removed generate-manual from the target's Frameworks and Libraries and it ran properly. generate-manual is itself a CLI tool and should not be linked into your target.

2 Likes

Bingo! Yes, the compiled tool now runs without error!

I don't think I deliberately configured that -- it must be the default.

Thanks so much.

On to the next problem..! :rofl: