From de3c380c673008ecd7c4c71e48ce31c2b4a83d17 Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Fri, 2 Feb 2024 13:25:14 -0800 Subject: [PATCH] updates --- .github/workflows/release.yml | 2 ++ .goreleaser.yaml | 16 +++++----- MANUAL.md | 58 ++++++++++++++++++++--------------- go.mod | 17 +++++++--- go.sum | 27 +++++++++++----- main.go | 26 ++++++++++++---- pkg/xt/job.go | 1 + pkg/xt/xt.go | 7 ++++- 8 files changed, 104 insertions(+), 50 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5637d29..da1e766 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,8 @@ jobs: gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }} - name: "Create GPG_SIGNING_KEY file" run: "echo '${{ secrets.GPG_SIGNING_KEY }}' > /tmp/key.gpg" + - name: "Save Iteration in Revision" + run: "REVISION=(git rev-list --count --all || echo 0) > $GITHUB_ENV" - uses: actions/setup-go@v5 with: go-version: stable diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 55259db..c1efaca 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -29,6 +29,8 @@ builds: - -X "golift.io/version.Version={{.Version}}" - -X "golift.io/version.BuildDate={{.Date}}" - -X "golift.io/version.BuildUser={{.Env.USER}}" + - -X "golift.io/version.Revision={{.Env.REVISION}}" + - -X "golift.io/version.Branch={{.Branch}} ({{.ShortCommit}})" ignore: - goos: windows goarch: arm @@ -71,13 +73,13 @@ nfpms: provides: - xt # signing - rpm: - signature: - key_file: "{{ .Env.GPG_SIGNING_KEY }}" - deb: - signature: - key_file: "{{ .Env.GPG_SIGNING_KEY }}" - type: origin + # rpm: + # signature: + # key_file: "{{ .Env.GPG_SIGNING_KEY }}" + # deb: + # signature: + # key_file: "{{ .Env.GPG_SIGNING_KEY }}" + # type: origin contents: - src: MANUAL.gz dst: /usr/share/man/man1/xt.1.gz diff --git a/MANUAL.md b/MANUAL.md index f2df3a2..1962e2b 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -4,7 +4,8 @@ xt(1) -- eXtractor Tool - Recursively decompress archives SYNOPSIS --- -`xt [options] [path [path] [path] ...]` +`xt [options] [path [path] [path] ...]` +`xt --job-file /tmp/job1 -j /tmp/job2`\ DESCRIPTION --- @@ -17,46 +18,55 @@ DESCRIPTION OPTIONS --- -`xt [-o ] [-d <#>] [-m <#>] [-p ] [paths]` +`xt [-o ] [-d <#>] [-m <#>] [-e <.ext>] [-p ] [paths]` - -o, --output - Provide a file system path where content should be written. - The default output path is the current working directory. +-o _directory_, --output _directory_ + Provide a file system _directory_ where content is written. + The default output _directory_ is the current working directory. - -d, --max-depth - This option limits how deep into the file system xt recurses. - The default is (0) unlimited. Setting to 1 disables recursion. +-d _count_, --max-depth _count_ + This option limits how deep into the file system xt recurses. + The default is (0) unlimited. Setting to 1 disables recursion. - -m, --min-depth - This option determines if archives should only be found deeper - into the file system. The default is (0) root. Archives are only - extracted from sub directories deep or deeper. +-m _count_, --min-depth _count_ + This option determines if archives should only be found deeper + into the file system. The default is (0) root. Archives are only + extracted from _count_ sub directories deep or deeper. - -P, --password , - Provided password(s) are attempted against extraction of encrypted - rar and/or 7zip archives. The -p option may be provided many times. +-P _password_, --password _password_ + Provided _passwords_ are attempted against extraction of encrypted + rar and/or 7zip archives. The `-p` option may be provided many times. - -j, --job-file - The options above create a single job. If you want more control, - you may provide one or more job files. Each file may define the - input, output, depths and passwords, etc. Acceptable formats are - xml, json, toml and yaml. TOML is the default. See JOB FILES below. +-e _.ext_, --extension _.ext_ + Only extract archives with these extensions. Include the leading dot. + The `-e` option may be provided many times. + Use `-v` for supported extensions. <- Your input must match the + supported extensions. Unknown extensions are still ignored. - -v, --version - Display version and exit. +-j _file_, --job-file _file_ + The options above create a single job. If you want more control, + you may provide one or more job files. Each _file_ may define the + input, output, depths and passwords, etc. Acceptable formats are + xml, json, toml and yaml. TOML is the default. See JOB FILES below. - -h, --help - Display usage and exit. +-v, --version + Display version and exit. + +-h, --help + Display usage and exit. JOB FILES --- +If `include_suffix` is provided `exclude_suffix` is ignored. + Example TOML job file: paths = [ '/path1', '/another/path' ] output = '.' passwords = [ 'password1', '''password"With'Specials!''', 'pass3'] exclude_suffix = ['.iso', '.gz'] + include_suffix = ['.zip', '.rar', '.r00'] max_depth = 0 min_depth = 1 file_mode = 644 diff --git a/go.mod b/go.mod index 7fbd892..47da916 100644 --- a/go.mod +++ b/go.mod @@ -5,21 +5,30 @@ go 1.20 require ( github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace golift.io/version v0.0.2 - golift.io/xtractr v0.2.3-0.20240130233802-72495ada05e7 + golift.io/xtractr v0.2.3-0.20240202194230-2edf9aff9619 +) + +require ( + github.com/cavaliergopher/cpio v1.0.1 // indirect + github.com/cavaliergopher/rpm v1.2.0 // indirect + github.com/peterebden/ar v0.0.0-20230524111245-4f7c7b065694 // indirect + github.com/sshaman1101/dcompress v0.0.0-20200109162717-50436a6332de // indirect + github.com/therootcompany/xz v1.0.1 // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect ) require ( github.com/BurntSushi/toml v1.3.0 // indirect - github.com/andybalholm/brotli v1.0.6 // indirect + github.com/andybalholm/brotli v1.1.0 // indirect github.com/bodgit/plumbing v1.3.0 // indirect github.com/bodgit/sevenzip v1.4.5 // indirect github.com/bodgit/windows v1.0.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/kdomanski/iso9660 v0.4.0 // indirect - github.com/klauspost/compress v1.17.4 // indirect + github.com/klauspost/compress v1.17.5 // indirect github.com/nwaples/rardecode v1.1.3 // indirect - github.com/pierrec/lz4/v4 v4.1.19 // indirect + github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/ulikunitz/xz v0.5.11 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/go.sum b/go.sum index 83cef42..d8ec527 100644 --- a/go.sum +++ b/go.sum @@ -19,14 +19,18 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/toml v1.3.0 h1:Ws8e5YmnrGEHzZEzg0YvK/7COGYtTC5PbaH9oSSbgfA= github.com/BurntSushi/toml v1.3.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI= -github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= +github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/bodgit/plumbing v1.3.0 h1:pf9Itz1JOQgn7vEOE7v7nlEfBykYqvUYioC61TwWCFU= github.com/bodgit/plumbing v1.3.0/go.mod h1:JOTb4XiRu5xfnmdnDJo6GmSbSbtSyufrsyZFByMtKEs= github.com/bodgit/sevenzip v1.4.5 h1:HFJQ+nbjppfyf2xbQEJBbmVo+o2kTg1FXV4i7YOx87s= github.com/bodgit/sevenzip v1.4.5/go.mod h1:LAcAg/UQzyjzCQSGBPZFYzoiHMfT6Gk+3tMSjUk3foY= github.com/bodgit/windows v1.0.1 h1:tF7K6KOluPYygXa3Z2594zxlkbKPAOvqr97etrGNIz4= github.com/bodgit/windows v1.0.1/go.mod h1:a6JLwrB4KrTR5hBpp8FI9/9W9jJfeQ2h4XDXU74ZCdM= +github.com/cavaliergopher/cpio v1.0.1 h1:KQFSeKmZhv0cr+kawA3a0xTQCU4QxXF1vhU7P7av2KM= +github.com/cavaliergopher/cpio v1.0.1/go.mod h1:pBdaqQjnvXxdS/6CvNDwIANIFSP0xRKI16PX4xejRQc= +github.com/cavaliergopher/rpm v1.2.0 h1:s0h+QeVK252QFTolkhGiMeQ1f+tMeIMhGl8B1HUmGUc= +github.com/cavaliergopher/rpm v1.2.0/go.mod h1:R0q3vTqa7RUvPofAZYrnjJ63hh2vngjFfphuXiExVos= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= @@ -77,8 +81,8 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/kdomanski/iso9660 v0.4.0 h1:BPKKdcINz3m0MdjIMwS0wx1nofsOjxOq8TOr45WGHFg= github.com/kdomanski/iso9660 v0.4.0/go.mod h1:OxUSupHsO9ceI8lBLPJKWBTphLemjrCQY8LPXM7qSzU= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= -github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/klauspost/compress v1.17.5 h1:d4vBd+7CHydUqpFBgUEKkSdtSugf9YFmSkvUYPquI5E= +github.com/klauspost/compress v1.17.5/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -86,8 +90,10 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc= github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= -github.com/pierrec/lz4/v4 v4.1.19 h1:tYLzDnjDXh9qIxSTKHwXwOYmm9d887Y7Y1ZkyXYHAN4= -github.com/pierrec/lz4/v4 v4.1.19/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/peterebden/ar v0.0.0-20230524111245-4f7c7b065694 h1:pDBk3JWSIjS3gNxwEk1RjGdyZLsyTW4pOHaShBs9FK8= +github.com/peterebden/ar v0.0.0-20230524111245-4f7c7b065694/go.mod h1:hpFkyhCgB5Rm8FK+ISypOE+9UyrCuL6MNcjPMB1s1ec= +github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= +github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -95,6 +101,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk= github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace h1:9PNP1jnUjRhfmGMlkXHjYPishpcw4jpSt/V/xYY3FMA= github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/sshaman1101/dcompress v0.0.0-20200109162717-50436a6332de h1:uIeuAon/xwRdiZaCmEd5mocquesYkWCf71WBO7obTmA= +github.com/sshaman1101/dcompress v0.0.0-20200109162717-50436a6332de/go.mod h1:XIUpD+1rteMazWrMFjNSpM6TocSHxDYXk6UEgBb5+F0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -103,6 +111,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/therootcompany/xz v1.0.1 h1:CmOtsn1CbtmyYiusbfmhmkpAAETj0wBIH6kCYaX+xzw= +github.com/therootcompany/xz v1.0.1/go.mod h1:3K3UH1yCKgBneZYhuQUvJ9HPD19UEXEI0BWbMn8qNMY= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= @@ -116,6 +126,7 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -235,8 +246,8 @@ golift.io/cnfgfile v0.0.0-20230531075023-f880041cc0a0 h1:u14MTHfTGx7kLX2b3wFbaES golift.io/cnfgfile v0.0.0-20230531075023-f880041cc0a0/go.mod h1:dVC3N+72/nHNlBv3cwXb4FQTxMAor+JlNClAldwACkY= golift.io/version v0.0.2 h1:i0gXRuSDHKs4O0sVDUg4+vNIuOxYoXhaxspftu2FRTE= golift.io/version v0.0.2/go.mod h1:76aHNz8/Pm7CbuxIsDi97jABL5Zui3f2uZxDm4vB6hU= -golift.io/xtractr v0.2.3-0.20240130233802-72495ada05e7 h1:y3hI6nN/DBahF6Hp+/M/vplgnAUJSBeekGnqomzO01Q= -golift.io/xtractr v0.2.3-0.20240130233802-72495ada05e7/go.mod h1:B608A7mLGU3gYciK+GichEUROa/Lp5NNrdmTPBb//o0= +golift.io/xtractr v0.2.3-0.20240202194230-2edf9aff9619 h1:rLCt2Q6zTh3yvs3mw0tujq7FiYq+Q1lc6DDNSV5U7lk= +golift.io/xtractr v0.2.3-0.20240202194230-2edf9aff9619/go.mod h1:B6NSeohycJeS5pur983rw8JUDptMfGldIjqXXtJ65Po= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= diff --git a/main.go b/main.go index ecaa593..86905cb 100644 --- a/main.go +++ b/main.go @@ -9,6 +9,7 @@ import ( "github.com/Unpackerr/xt/pkg/xt" flag "github.com/spf13/pflag" "golift.io/version" + "golift.io/xtractr" ) func parseFlags(pwd string) (*xt.Job, *flags) { @@ -27,12 +28,13 @@ func parseFlags(pwd string) (*xt.Job, *flags) { flag.StringVarP(&job.Output, "output", "o", pwd, "Output directory, default is current directory") flag.UintVarP(&job.MaxDepth, "max-depth", "d", 0, "Maximum folder depth to recursively search for archives.") flag.UintVarP(&job.MinDepth, "min-depth", "m", 0, "Minimum folder depth to recursively search for archives.") - // flag.UintVarP(&job.Recurse, "recurse", "r", 0, "Extract archives inside archives, up to this depth.") + flag.StringSliceVarP(&job.Include, "extension", "e", nil, "Only extract files with these extensions.") flag.StringSliceVarP(&job.Passwords, "password", "P", nil, "Attempt these passwords for rar and 7zip archives.") flag.StringSliceVarP(&flags.JobFiles, "job-file", "j", nil, "Read additional extraction jobs from these files.") + flag.Parse() // Preserve paths? // flag.BoolVarP(&job.Preserve, "preserve-paths", "", false, "Recreate directory hierarchy while extracting.") - flag.Parse() + // flag.UintVarP(&job.Recurse, "recurse", "r", 0, "Extract archives inside archives, up to this depth.") job.Paths = flag.Args() @@ -54,10 +56,7 @@ func main() { // Get 1 job and other flag info from cli args. cliJob, flags := parseFlags(pwd) - if flags.PrintVer { - fmt.Printf("xt v%s-%s (%s)\n", version.Version, version.Revision, version.Branch) - os.Exit(0) - } + printVer(flags.PrintVer) // Read in jobs from 1 or more job files. jobs, err := xt.ParseJobs(flags.JobFiles) @@ -81,3 +80,18 @@ func main() { xt.Extract(job) } } + +func printVer(print bool) { + if !print { + return + } + + fmt.Printf("xt v%s-%s (%s)\n", version.Version, version.Revision, version.Branch) + fmt.Println(" - Supported Extensions:") + + for _, ext := range xtractr.SupportedExtensions() { + fmt.Println(" ", ext) + } + + os.Exit(0) +} diff --git a/pkg/xt/job.go b/pkg/xt/job.go index 2127142..c4abab0 100644 --- a/pkg/xt/job.go +++ b/pkg/xt/job.go @@ -12,6 +12,7 @@ type Job struct { Output string `json:"output" yaml:"output" xml:"output" toml:"output"` Passwords []string `json:"passwords" yaml:"passwords" xml:"password" toml:"passwords"` Exclude []string `json:"excludeSuffix" yaml:"excludeSuffix" xml:"exclude_suffix" toml:"exclude_suffix"` + Include []string `json:"includeSuffix" yaml:"includeSuffix" xml:"include_suffix" toml:"include_suffix"` MaxDepth uint `json:"maxDepth" yaml:"maxDepth" xml:"max_depth" toml:"max_depth"` MinDepth uint `json:"minDepth" yaml:"minDepth" xml:"min_depth" toml:"min_depth"` DirMode FileMode `json:"dirMode" yaml:"dirMode" xml:"dir_mode" toml:"dir_mode"` diff --git a/pkg/xt/xt.go b/pkg/xt/xt.go index 24e8b6f..45f1cce 100644 --- a/pkg/xt/xt.go +++ b/pkg/xt/xt.go @@ -65,9 +65,14 @@ func (j *Job) getArchives() map[string][]string { continue } + exclude := j.Exclude + if len(j.Include) > 0 { + exclude = xtractr.AllExcept(j.Include...) + } + for folder, fileList := range xtractr.FindCompressedFiles(xtractr.Filter{ Path: fileName, - ExcludeSuffix: j.Exclude, + ExcludeSuffix: exclude, MaxDepth: int(j.MaxDepth), MinDepth: int(j.MinDepth), }) {