minitar-cli 0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Contributing.md +71 -0
- data/History.md +25 -0
- data/Licence.md +15 -0
- data/Manifest.txt +22 -0
- data/README.rdoc +105 -0
- data/Rakefile +47 -0
- data/bin/minitar +11 -0
- data/docs/bsdl.txt +19 -0
- data/docs/ruby.txt +56 -0
- data/lib/minitar/cli.rb +64 -0
- data/lib/minitar/cli/command.rb +46 -0
- data/lib/minitar/cli/command/create.rb +144 -0
- data/lib/minitar/cli/command/extract.rb +174 -0
- data/lib/minitar/cli/command/help.rb +57 -0
- data/lib/minitar/cli/command/list.rb +162 -0
- data/lib/minitar/cli/commander.rb +64 -0
- data/test/fixtures/bad-dir.tar.gz +0 -0
- data/test/fixtures/spaces.tar.gz +0 -0
- data/test/minitest_helper.rb +11 -0
- data/test/support/minitar_cli_test_helper.rb +15 -0
- data/test/test_cli_help.rb +71 -0
- data/test/test_cli_list.rb +123 -0
- metadata +265 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b7e1a33ed236a1c4df613b9176391edfa14b61eb
|
4
|
+
data.tar.gz: 1e961009d5987fe7bbfcb53a1d7fd681ee382a98
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b3748531f8787423e3d116d1b15a86d3e50781b7645c3b7c22fbf13eea27320608b52d2b6f44d3ff1ca59be380422e4e7198e6608ba1e5d4401e03dc4a0ef9bf
|
7
|
+
data.tar.gz: 24917476a4030a12b6af70d498b9ea2fcb70f9624a75504ce5902ea45833bb315c5653e1b296e78358ce691f438c448903b87db5731cfa846bc415a212d1c0aa
|
data/Contributing.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
## Contributing
|
2
|
+
|
3
|
+
I value any contribution to minitar-cli you can provide: a bug report, a
|
4
|
+
feature request, or code contributions. There are a few guidelines for
|
5
|
+
contributing to minitar:
|
6
|
+
|
7
|
+
* Code changes *will not* be accepted without tests. The test suite is
|
8
|
+
written with [Minitest][].
|
9
|
+
* Match my coding style.
|
10
|
+
* Use a thoughtfully-named topic branch that contains your change. Rebase
|
11
|
+
your commits into logical chunks as necessary.
|
12
|
+
* Use [quality commit messages][].
|
13
|
+
* Do not change the version number; when your patch is accepted and a release
|
14
|
+
is made, the version will be updated at that point.
|
15
|
+
* Submit a GitHub pull request with your changes.
|
16
|
+
* New or changed behaviours require appropriate documentation.
|
17
|
+
|
18
|
+
### Test Dependencies
|
19
|
+
|
20
|
+
minitar-cli uses Ryan Davis’s [Hoe][] to manage the release process, and it
|
21
|
+
adds a number of rake tasks. You will mostly be interested in:
|
22
|
+
|
23
|
+
$ rake
|
24
|
+
|
25
|
+
which runs the tests the same way that:
|
26
|
+
|
27
|
+
$ rake test
|
28
|
+
$ rake travis
|
29
|
+
|
30
|
+
will do.
|
31
|
+
|
32
|
+
To assist with the installation of the development dependencies for
|
33
|
+
minitar-cli, I have provided the simplest possible Gemfile pointing to the
|
34
|
+
(generated) `minitar-cli.gemspec` file. This will permit you to do:
|
35
|
+
|
36
|
+
$ bundle install
|
37
|
+
|
38
|
+
to get the development dependencies. If you aleady have `hoe` installed, you
|
39
|
+
can accomplish the same thing with:
|
40
|
+
|
41
|
+
$ rake newb
|
42
|
+
|
43
|
+
This task will install any missing dependencies, run the tests/specs, and
|
44
|
+
generate the RDoc.
|
45
|
+
|
46
|
+
You can run tests with code coverage analysis by running:
|
47
|
+
|
48
|
+
$ rake test:coverage
|
49
|
+
|
50
|
+
### Workflow
|
51
|
+
|
52
|
+
Here's the most direct way to get your work merged into the project:
|
53
|
+
|
54
|
+
* Fork the project.
|
55
|
+
* Clone down your fork (`git clone git://github.com/<username>/minitar-cli.git`).
|
56
|
+
* Create a topic branch to contain your change (`git checkout -b
|
57
|
+
my_awesome_feature`).
|
58
|
+
* Hack away, add tests. Not necessarily in that order.
|
59
|
+
* Make sure everything still passes by running `rake`.
|
60
|
+
* If necessary, rebase your commits into logical chunks, without errors.
|
61
|
+
* Push the branch up (`git push origin my_awesome_feature`).
|
62
|
+
* Create a pull request against halostatue/minitar-cli and describe what your
|
63
|
+
change does and the why you think it should be merged.
|
64
|
+
|
65
|
+
### Contributors
|
66
|
+
|
67
|
+
* Austin Ziegler created minitar-cli, extracted from Archive::Tar::Minitar.
|
68
|
+
|
69
|
+
[Minitest]: https://github.com/seattlerb/minitest
|
70
|
+
[quality commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
71
|
+
[Hoe]: https://github.com/seattlerb/hoe
|
data/History.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
## 0.6 / 2017-02-07
|
2
|
+
|
3
|
+
* Hello, minitar-cli. This is a new gem containing code originally from
|
4
|
+
archive-tar-minitar.
|
5
|
+
|
6
|
+
* Enhancements:
|
7
|
+
|
8
|
+
* Extracted `bin/minitar` from [minitar][].
|
9
|
+
* Replaced Satoru Takabayashi’s [Ruby Progress Bar][] with
|
10
|
+
[busyloop/powerbar][].
|
11
|
+
* Added filename filtering to `minitar list`.
|
12
|
+
|
13
|
+
* Bugs:
|
14
|
+
|
15
|
+
* Fixed a problem where `bin/minitar create` would not include dotfiles
|
16
|
+
on Unix systems.
|
17
|
+
|
18
|
+
* Development:
|
19
|
+
|
20
|
+
* Modernized minitar tooling around Hoe.
|
21
|
+
* Added travis and coveralls.
|
22
|
+
|
23
|
+
[minitar]: https://github.com/halostatue/minitar
|
24
|
+
[Ruby Progress Bar]: https://namazu.org/~satoru/ruby-progressbar/
|
25
|
+
[busyloop/powerbar]: https://github.com/busyloop/powerbar
|
data/Licence.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
## Licence
|
2
|
+
|
3
|
+
minitar-cli is free software that may be redistributed and/or modified under
|
4
|
+
the terms of Ruby’s licence or the Simplified BSD licence.
|
5
|
+
|
6
|
+
* Copyright 2004–2017 Austin Ziegler.
|
7
|
+
* Portions copyright 2004 Mauricio Julio Fernández Pradier.
|
8
|
+
|
9
|
+
### Simplified BSD Licence
|
10
|
+
|
11
|
+
See the file docs/bsdl.txt in the main distribution.
|
12
|
+
|
13
|
+
### Ruby’s Licence
|
14
|
+
|
15
|
+
See the file docs/ruby.txt in the main distribution.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Contributing.md
|
2
|
+
History.md
|
3
|
+
Licence.md
|
4
|
+
Manifest.txt
|
5
|
+
README.rdoc
|
6
|
+
Rakefile
|
7
|
+
bin/minitar
|
8
|
+
docs/bsdl.txt
|
9
|
+
docs/ruby.txt
|
10
|
+
lib/minitar/cli.rb
|
11
|
+
lib/minitar/cli/command.rb
|
12
|
+
lib/minitar/cli/command/create.rb
|
13
|
+
lib/minitar/cli/command/extract.rb
|
14
|
+
lib/minitar/cli/command/help.rb
|
15
|
+
lib/minitar/cli/command/list.rb
|
16
|
+
lib/minitar/cli/commander.rb
|
17
|
+
test/fixtures/bad-dir.tar.gz
|
18
|
+
test/fixtures/spaces.tar.gz
|
19
|
+
test/minitest_helper.rb
|
20
|
+
test/support/minitar_cli_test_helper.rb
|
21
|
+
test/test_cli_help.rb
|
22
|
+
test/test_cli_list.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
= minitar-cli
|
2
|
+
|
3
|
+
home :: https://github.com/halostatue/minitar-cli/
|
4
|
+
code :: https://github.com/halostatue/minitar-cli/
|
5
|
+
bugs :: https://github.com/halostatue/minitar-cli/issues
|
6
|
+
rdoc :: http://rdoc.info/gems/minitar-cli/
|
7
|
+
continuous integration :: {<img src="https://travis-ci.org/halostatue/minitar-cli.svg" />}[https://travis-ci.org/halostatue/minitar-cli]
|
8
|
+
{<img src="https://ci.appveyor.com/api/projects/status/bj4gqn3gp3gu45sa?svg=true" />}[https://ci.appveyor.com/project/halostatue/minitar-cli]
|
9
|
+
test coverage :: {<img src="https://coveralls.io/repos/halostatue/minitar-cli/badge.svg" alt="Coverage Status" />}[https://coveralls.io/r/halostatue/minitar-cli]
|
10
|
+
|
11
|
+
== Description
|
12
|
+
|
13
|
+
<tt>minitar-cli</tt> is a pure-Ruby command-line tool that uses
|
14
|
+
{minitar}[https://github.com/halostatue/minitar] to provide a command-line
|
15
|
+
tool, +minitar+, for working with POSIX tar(1) archive files.
|
16
|
+
|
17
|
+
This is release 0.6, extracted from {minitar}[https://halostatue.ca/minitar],
|
18
|
+
with modernizations.
|
19
|
+
|
20
|
+
== Synopsis
|
21
|
+
|
22
|
+
Using <tt>minitar-cli</tt> is easy; its functionality is provided through
|
23
|
+
<tt>bin/minitar</tt> (installed as +miniitar+). It supports three basic
|
24
|
+
commands: +create+, +extract+, and +list+.
|
25
|
+
|
26
|
+
All +minitar+ commands support two common options, +verbose+ and +progress+.
|
27
|
+
These are mutually exclusive and +progress+ has a higher priority than
|
28
|
+
+verbose+.
|
29
|
+
|
30
|
+
+verbose+:: <tt>--verbose</tt> (<tt>-V</tt>), puts the requested command in
|
31
|
+
verbose mode.
|
32
|
+
+progress+:: <tt>--progress</tt> (<tt>-P</tt>), shows a progress bar (if
|
33
|
+
appropriate) or puts the requested command in verbose mode.
|
34
|
+
|
35
|
+
=== +minitar create+
|
36
|
+
|
37
|
+
minitar create [OPTIONS] <tarfile|-> <file|directory|-->+
|
38
|
+
|
39
|
+
Creates a new tarfile. If the tarfile is named .tar.gz or .tgz, then it will be
|
40
|
+
compressed automatically. If the tarfile is "-", then it will be output to
|
41
|
+
standard output (stdout) so that minitar may be piped.
|
42
|
+
|
43
|
+
The files or directories that will be packed into the tarfile are
|
44
|
+
specified after the name of the tarfile itself. Directories will be
|
45
|
+
processed recursively. If the token "--" is found in the list of files
|
46
|
+
to be packed, additional filenames will be read from standard input
|
47
|
+
(stdin). If any file is not found, the packaging will be halted.
|
48
|
+
|
49
|
+
+create+ also supports the +compress+ option.
|
50
|
+
|
51
|
+
+compress+:: <tt>--compress</tt> (<tt>-z</tt>), compresses the tarfile with
|
52
|
+
gzip.
|
53
|
+
|
54
|
+
=== +minitar extract+
|
55
|
+
|
56
|
+
minitar extract [OPTIONS] <tarfile|-> [<file>+]
|
57
|
+
|
58
|
+
Extracts files from an existing tarfile. If the tarfile is named .tar.gz or
|
59
|
+
.tgz, then it will be uncompressed automatically. If the tarfile is "-", then
|
60
|
+
it will be read from standard input (stdin) so that minitar may be piped.
|
61
|
+
|
62
|
+
The files or directories that will be extracted from the tarfile are specified
|
63
|
+
after the name of the tarfile itself. Directories will be processed
|
64
|
+
recursively. Files must be specified in full. A file "foo/bar/baz.txt" cannot
|
65
|
+
simply be specified by specifying "baz.txt". Any file not found will simply be
|
66
|
+
skipped and an error will be reported.
|
67
|
+
|
68
|
+
+extract+ also supports the +uncompress+, +pipe+, and +output+ options.
|
69
|
+
|
70
|
+
+uncompress+:: <tt>--uncompress</tt> (<tt>-z</tt>), uncompresses the tarfile
|
71
|
+
with gzip.
|
72
|
+
+pipe+:: <tt>--pipe</tt>, emits the extracted files to STDOUT for piping.
|
73
|
+
+output+:: <tt>--output</tt> (<tt>-o</tt>), extracts the files to the specified
|
74
|
+
directory.
|
75
|
+
|
76
|
+
=== +minitar list+
|
77
|
+
|
78
|
+
minitar list [OPTIONS] <tarfile|-> [<file>+]
|
79
|
+
|
80
|
+
Lists files in an existing tarfile. If the tarfile is named .tar.gz or .tgz,
|
81
|
+
then it will be uncompressed automatically. If the tarfile is "-", then it will
|
82
|
+
be read from standard input (stdin) so that minitar may be piped.
|
83
|
+
|
84
|
+
The files or directories to be filtered are specified after the name of the
|
85
|
+
tarfile itself.
|
86
|
+
|
87
|
+
Both +verbose+ and +progress+ act as a file detail view, similar to <tt>ls
|
88
|
+
-l</tt>.
|
89
|
+
|
90
|
+
+list+ also supports the +uncompress+, +sort+, +reverse+, and +l+ options.
|
91
|
+
|
92
|
+
+uncompress+:: <tt>--uncompress</tt> <tt>-z</tt>, uncompresses the tarfile with
|
93
|
+
gzip.
|
94
|
+
+sort+:: <tt>--sort</tt> (<tt>-S</tt>), sorts the list of files by the
|
95
|
+
specified field. Supported sort fields are +name+ (the default),
|
96
|
+
+mtime+, and +size+.
|
97
|
+
+reverse+:: Reverses the sort.
|
98
|
+
+l+:: Lists the files in detail (like +verbose+).
|
99
|
+
|
100
|
+
== minitar-cli Semantic Versioning
|
101
|
+
|
102
|
+
The minitar-cli tool uses a {Semantic Versioning}[http://semver.org/] scheme
|
103
|
+
with one change:
|
104
|
+
|
105
|
+
* When PATCH is zero (+0+), it will be omitted from version references.
|
data/Rakefile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require 'rake/clean'
|
6
|
+
|
7
|
+
Hoe.plugin :doofus
|
8
|
+
Hoe.plugin :gemspec2
|
9
|
+
Hoe.plugin :git
|
10
|
+
Hoe.plugin :minitest
|
11
|
+
Hoe.plugin :travis
|
12
|
+
Hoe.plugin :email unless ENV['CI'] or ENV['TRAVIS']
|
13
|
+
|
14
|
+
spec = Hoe.spec 'minitar-cli' do
|
15
|
+
developer('Austin Ziegler', 'halostatue@gmail.com')
|
16
|
+
|
17
|
+
require_ruby_version '>= 1.8'
|
18
|
+
|
19
|
+
self.history_file = 'History.md'
|
20
|
+
self.readme_file = 'README.rdoc'
|
21
|
+
self.licenses = ['Ruby', 'BSD-2-Clause']
|
22
|
+
|
23
|
+
extra_deps << ['minitar', '~> 0.6.0']
|
24
|
+
extra_deps << ['powerbar', '~> 1.0']
|
25
|
+
|
26
|
+
extra_dev_deps << ['hoe-doofus', '~> 1.0']
|
27
|
+
extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
|
28
|
+
extra_dev_deps << ['hoe-git', '~> 1.6']
|
29
|
+
extra_dev_deps << ['hoe-rubygems', '~> 1.0']
|
30
|
+
extra_dev_deps << ['hoe-travis', '~> 1.2']
|
31
|
+
extra_dev_deps << ['minitest', '~> 5.3']
|
32
|
+
extra_dev_deps << ['minitest-autotest', ['>= 1.0', '<2']]
|
33
|
+
extra_dev_deps << ['rake', '>= 10.0', '< 12']
|
34
|
+
extra_dev_deps << ['rdoc', '>= 0.0']
|
35
|
+
end
|
36
|
+
|
37
|
+
if RUBY_VERSION >= '2.0' && RUBY_ENGINE == 'ruby'
|
38
|
+
namespace :test do
|
39
|
+
desc 'Run test coverage'
|
40
|
+
task :coverage do
|
41
|
+
spec.test_prelude = 'load ".simplecov-prelude.rb"'
|
42
|
+
Rake::Task['test'].execute
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
Rake::Task['travis'].prerequisites.replace(%w(test:coverage))
|
47
|
+
end
|
data/bin/minitar
ADDED
data/docs/bsdl.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Redistribution and use in source and binary forms, with or without
|
2
|
+
modification, are permitted provided that the following conditions are met:
|
3
|
+
|
4
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
5
|
+
list of conditions and the following disclaimer.
|
6
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
7
|
+
this list of conditions and the following disclaimer in the documentation
|
8
|
+
and/or other materials provided with the distribution.
|
9
|
+
|
10
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
11
|
+
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
12
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
13
|
+
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
14
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
15
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
16
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
17
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
18
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
19
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/docs/ruby.txt
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
4
|
+
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
6
|
+
software without restriction, provided that you duplicate all of the
|
7
|
+
original copyright notices and associated disclaimers.
|
8
|
+
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
10
|
+
you do at least ONE of the following:
|
11
|
+
|
12
|
+
a) place your modifications in the Public Domain or otherwise
|
13
|
+
make them Freely Available, such as by posting said
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
the author to include your modifications in the software.
|
16
|
+
|
17
|
+
b) use the modified software only within your corporation or
|
18
|
+
organization.
|
19
|
+
|
20
|
+
c) give non-standard binaries non-standard names, with
|
21
|
+
instructions on where to get the original software distribution.
|
22
|
+
|
23
|
+
d) make other distribution arrangements with the author.
|
24
|
+
|
25
|
+
3. You may distribute the software in object code or binary form,
|
26
|
+
provided that you do at least ONE of the following:
|
27
|
+
|
28
|
+
a) distribute the binaries and library files of the software,
|
29
|
+
together with instructions (in the manual page or equivalent)
|
30
|
+
on where to get the original distribution.
|
31
|
+
|
32
|
+
b) accompany the distribution with the machine-readable source of
|
33
|
+
the software.
|
34
|
+
|
35
|
+
c) give non-standard binaries non-standard names, with
|
36
|
+
instructions on where to get the original software distribution.
|
37
|
+
|
38
|
+
d) make other distribution arrangements with the author.
|
39
|
+
|
40
|
+
4. You may modify and include the part of the software into any other
|
41
|
+
software (possibly commercial). But some files in the distribution
|
42
|
+
are not written by the author, so that they are not under these terms.
|
43
|
+
|
44
|
+
For the list of those files and their copying conditions, see the
|
45
|
+
file LEGAL.
|
46
|
+
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
48
|
+
output from the software do not automatically fall under the
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
51
|
+
software.
|
52
|
+
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
56
|
+
PURPOSE.
|
data/lib/minitar/cli.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'minitar'
|
4
|
+
|
5
|
+
# The Minitar command-line application.
|
6
|
+
class Minitar::CLI
|
7
|
+
VERSION = '0.6'.freeze #:nodoc:
|
8
|
+
|
9
|
+
# rubocop:disable Lint/InheritException
|
10
|
+
class AbstractCommandError < Exception; end
|
11
|
+
# rubocop:enable Lint/InheritException
|
12
|
+
class UnknownCommandError < StandardError; end
|
13
|
+
class CommandAlreadyExists < StandardError; end
|
14
|
+
|
15
|
+
def self.run(argv, input = $stdin, output = $stdout, error = $stderr)
|
16
|
+
new(input, output, error).run(argv)
|
17
|
+
end
|
18
|
+
|
19
|
+
attr_reader :commander
|
20
|
+
attr_reader :ioe
|
21
|
+
|
22
|
+
def initialize(input = $stdin, output = $stdout, error = $stderr)
|
23
|
+
@ioe = {
|
24
|
+
:input => input,
|
25
|
+
:output => output,
|
26
|
+
:error => error
|
27
|
+
}
|
28
|
+
@commander = Minitar::CLI::Commander.new(ioe)
|
29
|
+
Minitar::CLI::Command.children.each do |command|
|
30
|
+
commander.register(command)
|
31
|
+
end
|
32
|
+
commander.default_command = 'help'
|
33
|
+
end
|
34
|
+
|
35
|
+
def run(argv)
|
36
|
+
opts = {}
|
37
|
+
|
38
|
+
output << "minitar #{VERSION}\n" if argv.include?('--version')
|
39
|
+
|
40
|
+
if argv.include?('--verbose') or argv.include?('-V')
|
41
|
+
opts[:verbose] = true
|
42
|
+
argv.delete('--verbose')
|
43
|
+
argv.delete('-V')
|
44
|
+
end
|
45
|
+
|
46
|
+
if argv.include?('--progress') or argv.include?('-P')
|
47
|
+
opts[:progress] = true
|
48
|
+
opts[:verbose] = false
|
49
|
+
argv.delete('--progress')
|
50
|
+
argv.delete('-P')
|
51
|
+
end
|
52
|
+
|
53
|
+
command = commander[(argv.shift or '').downcase]
|
54
|
+
command ||= commander['help']
|
55
|
+
command.call(argv, opts)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
require 'minitar/cli/command'
|
60
|
+
require 'minitar/cli/commander'
|
61
|
+
require 'minitar/cli/command/help'
|
62
|
+
require 'minitar/cli/command/create'
|
63
|
+
require 'minitar/cli/command/extract'
|
64
|
+
require 'minitar/cli/command/list'
|