summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-12-29 17:19:13 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-12-29 17:19:13 (GMT)
commitabe4fd77fc0e85c1e6ffaa25941414c83b090ea7 (patch)
tree468f9103e85ab601b62d821a4323b8c3f7585bf2 /Source/cmake.cxx
parent64b5118c78e4e56a7967166b3df2e1bfe73fa36b (diff)
downloadCMake-abe4fd77fc0e85c1e6ffaa25941414c83b090ea7.zip
CMake-abe4fd77fc0e85c1e6ffaa25941414c83b090ea7.tar.gz
CMake-abe4fd77fc0e85c1e6ffaa25941414c83b090ea7.tar.bz2
ENH: Make the syntax more line tar
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx51
1 files changed, 32 insertions, 19 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 0d9de9f..b13ca0f 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -720,8 +720,7 @@ void CMakeCommandUsage(const char* program)
<< " copy_directory source destination - copy directory 'source' content to directory 'destination'\n"
<< " echo [string]... - displays arguments as text\n"
<< " remove file1 file2 ... - remove the file(s)\n"
- << " tar file.tar file/dir1 file/dir2 ... - create a tar\n"
- << " untar file.tar - create a tar\n"
+ << " tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar.\n"
<< " time command [args] ... - run command and return elapsed time\n";
#if defined(_WIN32) && !defined(__CYGWIN__)
errorStream
@@ -949,33 +948,47 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
// Tar files
else if (args[1] == "tar" && args.size() > 3)
{
- std::string outFile = args[2];
+ std::string flags = args[2];
+ std::string outFile = args[3];
std::vector<cmStdString> files;
- for (std::string::size_type cc = 3; cc < args.size(); cc ++)
+ for (std::string::size_type cc = 4; cc < args.size(); cc ++)
{
files.push_back(args[cc]);
}
- if ( !cmSystemTools::CreateTar(outFile.c_str(), files) )
+ bool gzip = false;
+ bool verbose = false;
+ if ( flags.find_first_of('z') != flags.npos )
{
- cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
- return 1;
+ gzip = true;
+ }
+ if ( flags.find_first_of('v') != flags.npos )
+ {
+ verbose = true;
}
- return 0;
- }
- // Untar files
- else if (args[1] == "untar" && args.size() > 2)
- {
- std::string outFile = args[2];
- std::vector<cmStdString> files;
- for (std::string::size_type cc = 3; cc < args.size(); cc ++)
+ if ( flags.find_first_of('t') != flags.npos )
{
- files.push_back(args[cc]);
+ if ( !cmSystemTools::ListTar(outFile.c_str(), files, gzip, verbose) )
+ {
+ cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
+ return 1;
+ }
}
- if ( !cmSystemTools::ExtractTar(outFile.c_str(), files) )
+ else if ( flags.find_first_of('c') != flags.npos )
{
- cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
- return 1;
+ if ( !cmSystemTools::CreateTar(outFile.c_str(), files, gzip, verbose) )
+ {
+ cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
+ return 1;
+ }
+ }
+ else if ( flags.find_first_of('x') != flags.npos )
+ {
+ if ( !cmSystemTools::ExtractTar(outFile.c_str(), files, gzip, verbose) )
+ {
+ cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
+ return 1;
+ }
}
return 0;
}