Comments (8)
To clarify a few scenarios:
-c | config in -c dir | -f | result |
---|---|---|---|
yes | no | no | error |
yes | yes | no | use in dir |
yes | no | yes | use -f |
yes | yes | yes | use -f |
no | - | - | do as before |
Does that line up with what you would expect in this cases?
from vendir.
Hmmm, that seems to complicate things unnecessarily, and doesn't capture the important thing about how relative paths are calculated with -f
.
My simple rule would have been that if -c
is specified, change to that working directory first before evaluating any other options for paths.
Thus if you use -f
as well, then any relative path supplied to it would then be evaluated relative to the directory you changed to.
So:
vendir -c somedir -f relative/path
would be the same as having said:
(cd somedir; vendir -f relative/path)
So yes the table is sort of correct, but misses detail about what happens with relative paths supplied to -f
.
from vendir.
do we have some precedent in other tools to do something like this? tar does have -C that does something related.
from vendir.
There's many other tools that support this model as well as many that don't. Is it a requirement that other tools do the same or that is proven to be convenient?
from vendir.
There's many other tools that support this model
im just not familiar with any except tar. do you have some concrete examples (especially for commonly used tools)?
Is it a requirement that other tools do the same
it's not a requirement, but it's definitely an important part of research. id like to see if other tools do it because -C affects all other flags that take in files. it also might be good to understand what makes vendir special as compared to other tools (i hope this wont be a pattern we add to all others). additionally (cd package/foo/bundle; vendir sync)
seems like a pretty standard pattern in bash scripts, so adding this feature to eliminate need for subshell seems a bit too special.
from vendir.
im just not familiar with any except tar. do you have some concrete examples (especially for commonly used tools)?
It's not so common because typically tools don't need to work relative to the current directory. Most tools do support specify the root of the "context" of where actions will take place. As an example, kubectl does this when you do kubectl -f dir/sub-dir
and many other tools do follow this practice, but since vendir (like any of the other compressing tools, zip, ...) will take current dir as root to use, then they do provide an alternate flag.
Another tool I can think of, as developer that I use is [odo](https://github.com/openshift/odo)
that provides 2 flags:
odo create -h
--context string Use given context directory as a source for component settings
--devfile string Path to the user specified devfile
It's not specific that the tool changes directory but that can specify the root of where actions should take place.
(cd package/foo/bundle; vendir sync)
is a common pattern that is nice for all those ops people that can do that. tar, zip and all other tools could have done the same pattern, but decided that their users probably didn't need to be advanced enough to know about subshells, etc... Also, providing the functionality from within the tool, prevents different behaviour in different OSes, and simplify scripts.
from vendir.
added --chdir flag: 85f693d. will be included in upcoming release.
from vendir.
included in https://github.com/vmware-tanzu/carvel-vendir/releases/tag/v0.22.0
from vendir.
Related Issues (20)
- Function tryTarWithGzip (carvel-vendir/pkg/vendir/fetch/archive.go) loses link/symlink/mode/UID/GID/etc. in extracting .tar and .tar.gz files HOT 2
- Support s3:// protocol HOT 3
- Publish `v0.30.0` through the Carvel Homebrew tap HOT 2
- :bird: Please tweet about v0.31.0 release :pray: HOT 3
- clearer error message if path for githubrelease archive does not exist
- `vendir` should retain directory permissions HOT 14
- Vendir is failing to sync a dir if the previous sync has `disableUnpack: true` HOT 1
- Project contains AGPL code, which sets off license scanners HOT 4
- Vendir fails with a misterious error HOT 7
- Authenticate to git provider using single sigin-on HOT 3
- Error parsing empty yaml documents HOT 1
- Support for unpacking .xz archives HOT 3
- helm chart vendoring should also allow for vendoring dependencies HOT 1
- vendir doesn't load correct keychains when provided with the environment variables
- support for Gitlab Releases as source
- Sync fails when providing the same secret more than once
- vendir support for "dot" paths without conflict HOT 2
- Add post sync ability to rename files HOT 1
- Feature request: add option for skipping SSL verification when using Git HOT 3
- v0.34.0 - Running `vendir sync` fetches outdated repo when pointed at tag HOT 22
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vendir.