buck
buck copied to clipboard
[feature request] option to set working directory
Hi, would it be possible to add an option like gmake
's -C
(--directory
)?
-C DIRECTORY, --directory=DIRECTORY
Change to DIRECTORY before doing anything.
Right now, it seems I need to cd
somewhere inside the buck project folder before being able to invoke buck
. That is a little disruptive since most of the time my working directory is not inside the buck project directory, and setting the working directory changes my shell's global state. I cannot just "arrow up" to my buck
command and hit enter, without also changing directory first.
Example: Instead of
pushd ~/MYBUCKPROJDIR
buck build //TARGETDIR:TARGET @mode/opt --out ~/bin
popd
I would like to do this:
buck build -C ~/MYBUCKPROJDIR //TARGETDIR:TARGET @mode/opt --out ~/bin
Note that this is not about specifying the relative target path, relative to the buck root. It is about being able to build without cd
-ing out of my working directory outside of the buck project.
In my career, I have found gmake
's -C
option very convenient, and even added the same option to my own tools to avoid the state change.
Thanks!
If you prefix target and mode file with //
it should work anywhere in the repo. E.g.:
buck build //target @//mode/opt --out ~/bin
Thanks for the quick response. I clarified my issue description that this is not about specifying the relative target path, relative to the buck root, but about being able to build without changing the working directory away from any working directory, which is most of the time outside the buck project folder. Thanks!
Got it. Well, you're welcome to send the PR 🙂