Repository navigation
feat: Add command -cwd (change working directory) - #1024
Merged
Merged
Conversation
helmesjo
force-pushed
the
feature-add-cwd-option
branch
from
March 17, 2024 23:12
e6500f4 to
0dfbc25
Compare
Owner
|
Thanks for your pull request! It looks like this may be your first contribution to cppfront. I've emailed you the Contributor License Agreement (CLA), and once it's signed I can look at your pull request. Thanks again for your contribution. |
helmesjo
force-pushed
the
feature-add-cwd-option
branch
from
March 20, 2024 09:19
0dfbc25 to
ab0f9ec
Compare
Contributor
Author
Sure thing! Do you mind re-sending it though? My email got a bit mixed up so you sent it to the wrong one. |
Makes it possible to have
cppfrontoutput generated files into a separate directory (unless-outputis specified).Before:
After (when using
-cwd):$ ls ./hello.cpp2 subdir/ $ cppfront -cwd ./subdir ./hello.cpp $ tree . ├── hello.cpp2 └── subdir └── hello.cppSide note:
Arguably the output path should always be the current working directory with option to retain relative sub-directory hierarchy, eg. when passing multiple files (this is how most tools operate), and not be derived from input files. Though I assumed that would break tests (and require more special handling/options).
So running
cd build && cppfront [options] $(find . -name "*.h2" -o -name "*.cpp2")with this structure:$ tree ├── one.cpp2 ├── one.h2 └── subdir1 ├── subdir2 │ ├── three.cpp2 │ └── three.h2 ├── two.cpp2 └── two.h2 $ mkdir build && cd build && cppfront [options] $(find . -name "*.h2" -o -name "*.cpp2")could yield this result:
$ tree ├── build │ ├── one.cpp │ ├── one.h │ └── subdir1 │ ├── subdir2 │ │ ├── three.cpp │ │ └── three.h │ ├── two.cpp │ └── two.h ├── one.cpp2 ├── one.h2 └── subdir1 ├── subdir2 │ ├── three.cpp2 │ └── three.h2 ├── two.cpp2 └── two.h2