mirror of
https://gitea.home.endeavr.de/Marcel/Tarstats-pp.git
synced 2025-12-10 08:39:02 +01:00
Compare commits
8 Commits
v0.9-beta.
...
v1.0.1.-Fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3446ca5866 | ||
|
|
626494720d | ||
|
|
4536939938 | ||
|
|
3667502404 | ||
|
|
0f38d9dd2b | ||
|
|
499ad38401 | ||
|
|
75061d677d | ||
|
|
119fdff520 |
@@ -6,9 +6,9 @@ set(CMAKE_CXX_STANDARD 20)
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -std=c++20")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -std=c++20")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_executable(tarstats_pp main.cpp tarconst.h tarfunc.cpp tarfunc.h)
|
add_executable(tarstats_pp main.cpp tarconst.h tarfunc.cpp tarfunc.h)
|
||||||
target_link_libraries(tarstats_pp -lz)
|
target_link_libraries(tarstats_pp -lz)
|
||||||
|
|
||||||
install(TARGETS tarstats_pp)
|
install(TARGETS tarstats_pp)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
48
README.md
48
README.md
@@ -1,11 +1,51 @@
|
|||||||
# Tarstats-pp
|
# Tarstats-++
|
||||||
Tool to provide stats of a tarball.
|
Tool to provide stats of a tarball.
|
||||||
|
http://github.com/blindi815/Tarstats-pp
|
||||||
|
Version: v1.0.1-FixRelease
|
||||||
|
|
||||||
## Info
|
## General information
|
||||||
This is a little command line tool to provide statistics on a GNU tar file. It is a personal project to further self study programming using C++.
|
This is a little command line tool to provide statistics on a GNU tar file. It is a personal project to further self study programming using C++.
|
||||||
|
|
||||||
The project is inspired by https://github.com/isotopp/tarstats by @github/isotopp and the Twitter thread https://twitter.com/isotopp/status/1489549907841146882
|
The project is inspired by https://github.com/isotopp/tarstats by @github/isotopp and the Twitter thread https://twitter.com/isotopp/status/1489549907841146882
|
||||||
|
|
||||||
## Goal
|
### Limitations
|
||||||
Goal is to provide stats like total amount of files/ directories and printing them out to stdout, a plain text file and JSON. Support for GNU zip compressed files will come too.
|
This tool works on standard .tar files as well on tarfiles compressed by GNU zip. Other compression methods are not supported. This does not yet parse tarballs inside a tarball.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
Building this requires a version of zlib (http://zlib.net) on the target system. Common Linux distributions include zlib, yet the dev portions might be missing and have to installed first. In case of Ubuntu `zlib1g-dev`. Consult the provider of the distribution of your choice.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
```
|
||||||
|
cmake .
|
||||||
|
sudo cmake --build .
|
||||||
|
sudo cmake --install .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```
|
||||||
|
$ tarstats_pp
|
||||||
|
usage: tarstats-pp [-h] [-j] [-f] tarfile [tarfile...]
|
||||||
|
A tool to calculate basics statistics on tarball. Shamelessly inspired by github.com/isotopp/tarstats!
|
||||||
|
|
||||||
|
mandatory argument:
|
||||||
|
tarfile a tarfile to calculate stats on
|
||||||
|
|
||||||
|
optional arguments
|
||||||
|
-h this helptext
|
||||||
|
-j stats in JSON format printed to stdout
|
||||||
|
-f print stats to file <tarfilename>.txt or .json if -j invoked
|
||||||
|
```
|
||||||
|
```
|
||||||
|
$ tarstats_pp -j zlib-1.2.11.tar.gz
|
||||||
|
{"type": "gzarchive", "name": "zlib-1.2.11.tar.gz", "size": 607698, "itemsize": 2984023, "files": 253, "dir": 40, "symlinks": 0, "hardlinks": 0, "other": 0}
|
||||||
|
|
||||||
|
GLOBAL STATS
|
||||||
|
File amount: 1
|
||||||
|
Size of all archives: 607698 Bytes
|
||||||
|
Size of all items: 2984023 Bytes
|
||||||
|
DIRECTORIES: 40
|
||||||
|
FILES: 253
|
||||||
|
HARDLINKS: 0
|
||||||
|
OTHER: 0
|
||||||
|
SYMLINKS: 0
|
||||||
|
```
|
||||||
|
|||||||
4
main.cpp
4
main.cpp
@@ -1,4 +1,6 @@
|
|||||||
/*
|
/* Tool to provide stats of a tarball.
|
||||||
|
* http://github.com/blindi0815/Tarstats-pp
|
||||||
|
*
|
||||||
* by Marcel Nowicki (github@epenis.de | github.com/blindi0815)
|
* by Marcel Nowicki (github@epenis.de | github.com/blindi0815)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
10
tarconst.h
10
tarconst.h
@@ -10,6 +10,9 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace tarconstant {
|
namespace tarconstant {
|
||||||
|
//global version
|
||||||
|
inline std::string const version = "v1.0.1-FixRelease";
|
||||||
|
|
||||||
// global itemtype definition
|
// global itemtype definition
|
||||||
inline std::string const typeFile = "FILES";
|
inline std::string const typeFile = "FILES";
|
||||||
inline std::string const typeDir = "DIRECTORIES";
|
inline std::string const typeDir = "DIRECTORIES";
|
||||||
@@ -28,17 +31,18 @@ namespace tarconstant {
|
|||||||
inline std::pair<uint8_t , uint8_t> itemoctlnByte {124,11}; // at offset 124 because first byte
|
inline std::pair<uint8_t , uint8_t> itemoctlnByte {124,11}; // at offset 124 because first byte
|
||||||
// marks octal or base256 coding
|
// marks octal or base256 coding
|
||||||
inline std::string helptext
|
inline std::string helptext
|
||||||
{"usage: tarstats-pp [-h] [-j] [-f] tarfile.\n"
|
{"usage: tarstats-pp [-h] [-j] [-f] tarfile [tarfile...]\n"
|
||||||
"A tool to calculate basics statistics on tarball. Shamelessly inspired by github.com/isotopp/tarstats!\n\n"
|
"A tool to calculate basics statistics on tarball. Shamelessly inspired by github.com/isotopp/tarstats!\n\n"
|
||||||
"mandatory argument:\n"
|
"mandatory argument:\n"
|
||||||
"tarfile a tarfile to calculate stats on\n\n"
|
"tarfile a tarfile to calculate stats on\n\n"
|
||||||
"optional arguments\n"
|
"optional arguments\n"
|
||||||
"-h this helptext\n"
|
"-h this helptext\n"
|
||||||
"-j stats in JSON format printed to stdout\n"
|
"-j stats in JSON format printed to stdout\n"
|
||||||
"-f print stats to file <tarfilename>.txt or .json if -j invoked\n\n"
|
"-f print stats to file <tarfilename>.txt or .json + global.json if -j invoked\n\n"
|
||||||
"Find more information as well as full source at github.com/blindi0815/Tarstats-pp."
|
"Find more information as well as full source at github.com/blindi0815/Tarstats-pp."
|
||||||
"This software is as is under a GPL 3.0 license.\n\n"
|
"This software is as is under a GPL 3.0 license.\n\n"
|
||||||
"Written by Marcel Nowicki - github.com/blindi0815"};
|
"Written by Marcel Nowicki - github.com/blindi0815/Tarstats_pp\n\n"
|
||||||
|
"Version information: " + tarconstant::version + "\n"};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //TARSTATS___TARCONST_H
|
#endif //TARSTATS___TARCONST_H
|
||||||
|
|||||||
Reference in New Issue
Block a user