GithubHelp home page GithubHelp logo

Comments (3)

marcospb19 avatar marcospb19 commented on June 17, 2024 1

The output of "ouch --help" gives "Usage: ouch [OPTIONS] " the options before the command. Is it necessary to respect the order?

No, --gitignore is currently a global flag because it applies to all 3 subcommands.

Thanks for your input, having a --exclude flag sounds like a great path to solve this one.

from ouch.

marcospb19 avatar marcospb19 commented on June 17, 2024

This can be a bit confusing, here's how -g/--gitignore works:

When recursing through directory entries, do not include the ones in .gitignore.

(This can be useful if you want to compress a repository without including the build artifacts.)

However, you can bypass -g/--gitignore by providing the explicit name of the files you want.

That's what you're doing, your shell (bash, zsh or fish) expands * to the two arguments "PNG.zip" and "SVG.zip", so you're bypassing the -g flag.


The current workaround would be to pass the folder itself to Ouch.

cd ..
ouch compress folder testo.tar.gz --gitignore

But we can also discuss wether we want to remove the capability to bypass --gitignore.


  -g, --gitignore
          Ignores files matched by git's ignore files

Also, we need to update the --help to make this clear, and maybe document it in README.md.

from ouch.

micisse avatar micisse commented on June 17, 2024

@marcospb19 Thanks for your response

However, you can bypass -g/--gitignore by providing the explicit name of the files you want.

The files contained in folders are too numerous to be defined by hand. That's why I took PNG.zip and SVG.zip to create this issue. πŸ”₯.

The current workaround would be to pass the folder itself to Ouch.

It wasn't the folder I wanted to compress, but the contents only, and above all to be able to access the files directly when opening the archive (to avoid --strip-components=1 with tar for example).

That's what you're doing, your shell (bash, zsh or fish) expands * to the two arguments "PNG.zip" and "SVG.zip", so you're bypassing the -g flag.

The idea is to take everything (*) in the folder but exclude the files mentioned in .gitignore and/or .gitignore file itself. To use git with .gitignore file, you have to be in the folder itself at the root of the .git folder and the git command takes .gitignore into account in the same place, no need to pass the parent folder.


Ouch could perhaps be inspired by the "tar" command with --exclude arg. Passing several exclusion arguments in the same way (--exclude "<regex/*.ext/string...etc>") otherwise the .gitignore or .ouchignore file idea is also good to avoid multiple --exclude arguments.

tar -czvf testo.tar.gz --exclude "*.zip" --exclude "*.tar.gz" -C <path> .(dot) --overwrite
tar -czvf testo.tar.gz --exclude "*.zip" --exclude "*.tar.gz" .(dot) --overwrite

Capture d’écran_2023-09-11_20-49-46

The output of "ouch --help" gives "Usage: ouch [OPTIONS] <COMMAND>" the options before the command. Is it necessary to respect the order?

from ouch.

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.