From 3b47eec7eafe021389fd1c6f3167f526b57a5848 Mon Sep 17 00:00:00 2001 From: Unbewohnte Date: Mon, 17 Jan 2022 20:00:50 +0300 Subject: [PATCH] README; install and uninstall scripts --- .gitignore | 1 + README.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++ install.sh | 12 ++++++++ src/main.cpp | 17 ++++------- uninstall.sh | 4 +++ 5 files changed, 104 insertions(+), 12 deletions(-) create mode 100644 README.md create mode 100755 install.sh create mode 100755 uninstall.sh diff --git a/.gitignore b/.gitignore index 1f45822..6e5a40a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ build/CMakeFiles/ build/cmake_install.cmake build/CMakeCache.txt build/Makefile +scan_results.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..f437f28 --- /dev/null +++ b/README.md @@ -0,0 +1,82 @@ +# Broom +## incurable hoarder`s helpful friend + +``` + _ + // + // + // + // + /####/ + ////// +/////// +``` + +### Broom is a command line utility to locate and manage duplicate and empty files + +--- + +## Installation + +### "Compile it yourself" way + +- clone this repository + +`git clone https://github.com/Unbewohnte/broom` + +- proceed to the directory + +- compile manually or with cmake (in `build/` run:) + +`cmake .` + +`cmake --build .` + +compiled binary for your platform will be in the newly created `bin` directory, you are free to put it +wherever you desire + +if you're on GNU/Linux - you can run `install.sh` for broom to become system-wide accessible + + +### "The lazy" way + +- proceed [to the releases page](https://github.com/Unbewohnte/broom/releases) and get yourself a pre-compiled binary + + +--- + +## Usage + +broom [FLAGS..] [COMMAND] [DIRECTORY] + +[FLAGS] + +- `-v` or `--version` -> print version information and exit +- `-h` or `--help` -> print this message and exit + +[COMMANDS] + +- `sweep` -> scan for duplicate files, save results in a file and REMOVE empty files +- `scan` -> scan and save results in a file without removing anything [DEFAULT] + + +[DIRECTORY] is the path to the directory that will be searched for duplicate files + +### Examples + +- `broom scan ~/homework` +- `broom sweep ~/homework/I/have/a/lot/of/empty/files/here/for/some/reason` + +after the scan the results file will be saved in your current working directory, scan results file contains +a list of duplicate files that are grouped together so you can see EXACTLY WHERE each duplicate is in the filesystem. + +--- + +## License +GPLv3 + +--- + +## TODO +- Make it go `P` A `R` A `L` L `E` L +- Output approximate size that could be freed \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..67ecedb --- /dev/null +++ b/install.sh @@ -0,0 +1,12 @@ +BUILD_DIR="build" +OUTPUT_DIR="bin" +DEST_DIR="/usr/local/bin/" +BROOM_EXE_NAME="broom" + +if [ -e $OUTPUT_DIR/$BROOM_EXE_NAME ] +then + mv $OUTPUT_DIR/$BROOM_EXE_NAME $DEST_DIR +else + echo "Broom not found in bin/" +fi + diff --git a/src/main.cpp b/src/main.cpp index 5420ab7..f95a860 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,7 +28,7 @@ along with broom. If not, see . #include "broom.hpp" // Broom version number -#define VERSION "v0.2.0" +#define VERSION "v0.2.1" void print_help() { std::cout @@ -39,7 +39,10 @@ void print_help() { << "[COMMANDS]" << std::endl << "sweep -> scan for duplicate files, save results in a file and REMOVE empty files" << std::endl - << "scan -> scan and save results in a file without touching any files [DEFAULT]" << std::endl + << "scan -> scan and save results in a file without removing anything [DEFAULT]" << std::endl << std::endl + + << "[DIRECTORY]" << std::endl + << "path to the directory to be scanned" << std::endl << std::endl; }; @@ -108,16 +111,6 @@ int main(int argc, char* argv[]) { broom::Broom broom; try { - // auto t0 = std::chrono::high_resolution_clock::now(); - /* - auto tracking_time = std::chrono::high_resolution_clock::now(); - - std::cout - << "[BENCHMARK] Tracking took " - << std::chrono::duration_cast(tracking_time - t0).count() - << " ms" << std::endl; - */ - std::cout << " _" << std::endl << " //" << std::endl diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..d1a0fe4 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,4 @@ +BROOM_DIR="/usr/local/bin/" +BROOM_EXE_NAME="broom" + +rm -f $BROOM_DIR/$BROOM_EXE_NAME \ No newline at end of file