Git Product home page Git Product logo

Comments (8)

ewrenn8 avatar ewrenn8 commented on August 22, 2024

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.

GrahamDumpleton avatar GrahamDumpleton commented on August 22, 2024

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.

cppforlife avatar cppforlife commented on August 22, 2024

do we have some precedent in other tools to do something like this? tar does have -C that does something related.

from vendir.

jorgemoralespou avatar jorgemoralespou commented on August 22, 2024

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.

cppforlife avatar cppforlife commented on August 22, 2024

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.

jorgemoralespou avatar jorgemoralespou commented on August 22, 2024

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.

cppforlife avatar cppforlife commented on August 22, 2024

added --chdir flag: 85f693d. will be included in upcoming release.

from vendir.

cppforlife avatar cppforlife commented on August 22, 2024

included in https://github.com/vmware-tanzu/carvel-vendir/releases/tag/v0.22.0

from vendir.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.