Implemented simple 'bat pack' CLI command
No path rewriting yet, just simply copying the dependencies. They are copied to the target directory + the path relative to the current working directory. For example: bat pack scenes/05-barber/05_02_C-agent_focused/05_02_C.lighting.blend /tmp/packer will write to /tmp/packer/scenes/05-barber/05_02_C-agent_focused/05_02_C.lighting.blend and will copy ./path/to/file → /tmp/packer/path/to/file
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""Common functionality for CLI parsers."""
|
||||
import pathlib
|
||||
|
||||
|
||||
def add_flag(argparser, flag_name: str, **kwargs):
|
||||
@@ -14,3 +15,9 @@ def add_flag(argparser, flag_name: str, **kwargs):
|
||||
**kwargs)
|
||||
|
||||
|
||||
def shorten(cwd: pathlib.Path, somepath: pathlib.Path) -> pathlib.Path:
|
||||
"""Return 'somepath' relative to CWD if possible."""
|
||||
try:
|
||||
return somepath.relative_to(cwd)
|
||||
except ValueError:
|
||||
return somepath
|
||||
|
||||
Reference in New Issue
Block a user