Rmt - similar to the rm command, but it allows me to save the deleted elements in the trash

Overview

๐Ÿ—‘๏ธ Rmt.rs

Fun fact: Stable diffusion generated this logo ๐ŸŽจ

Rmt is similar to the rm command, but it allows me to save the deleted elements in the trash. If you wish, you can restore the previously deleted elements of your choice (or delete them forever) with a cli.

UmzJ1r8Z7D

โ€ผ๏ธ Rmt is not stable yet, do not use it for critical usages for the moment

๐Ÿ‘จ๐Ÿฝโ€๐Ÿ’ป Installation

โšก๏ธ Quick start

Download the binary depending on your configuration here: https://github.com/AmineZouitine/rmt.rs/releases

Then you just need to enter this command in your terminal:

tar -xf <downloaded_archive> rmt && sudo mv rmt /usr/local/bin

๐Ÿ˜Ž Pro tip (optional)

Add rmt as an alias instead of the rm command.

Features

๐Ÿšฎ Delete an element (but it is saved in the trash don't worry)

rmt [OPTION]... [FILE|FOLDER]...

Exemples: 
rmt text.txt
rmt * -- -text.txt
rmt folder test.txt *.sh

โœจ I like to use -f option, to remove all the warnings.

๐Ÿ“บ Launch CLI to restore or flush elements

rmt --td

โŒ Flush all element from the trash

rmt --tf

๐Ÿ”Ž Informations about the trash

rmt --ti

๐Ÿซต Contribution

You can find all the information in the file CONTRIBUTING.md. Hoping to see you soon in my pull request ๐Ÿ˜Š

Comments
  • [opinion] trash commands should not look like filenames

    [opinion] trash commands should not look like filenames

    Hello,

    this is just a drive-by comment as this was linked on HN, so feel free to ignore as I'm unlikely to keep using it (my solution to this problem is regular filesystem snapshots)

    I think trash info/display/flush commands could very well be valid filenames (in particular the two letter aliases, I use t* with short names a lot for temporary files)

    In particular that can be bad with wildcards: for example rmt something ti will just do ti action so rmt * is likely to not delete stuff as expected. (For scripts obviously the same problem as normal rm and friends apply, one should use rm -- * or rm ./*. Note rmt does not seem to handle -- either. But for interactive use having commands prefixed with -- is more natural.)

    By the way I got panic when restoring the same file multiple times and entering '..' in restore path (aren't I a good monkey):

    Please enter a new absolute path to restore your element
    >> /home/myuser/../
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', src/trash_manager.rs:270:6
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    but more importantly it doesn't handle cross dev errors either (leaving aside the fact that one cannot enter a path from /...); it should probably fallback to copy:

    >> /home/myuser/../../tmp
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 18, kind: CrossesDevices, message: "Invalid cross-device link" }', src/trash_manager.rs:270:6
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    (oh, and max_size in the config doesn't seem to do what I think it should do, but I didn't check if it's actually meant to be used yet nor documented)

    Anyway, nitpicks aside it's a good idea; I've seen other implementations but nothing seems to take so good luck :)

    opened by martinetd 3
  • panicking when crossing devices

    panicking when crossing devices

    Removing a file from a different device (ie. ramdisk) causes a crash when calling the fs::rename function:

    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 18, kind: CrossesDevices, message: "Cross-device link" }', src/trash_manager.rs:83:46
    
    opened by neurospochtsfroind 2
  • Compression of data in the trash

    Compression of data in the trash

    Add an option to automatically compress the items in the recycle garbage can, allowing to reduce its size.

    For this, we can use the existing configuration file.

    opened by AZironman 0
  • Fetch strings from Cargo.toml.

    Fetch strings from Cargo.toml.

    If merged โ€” if you feel this isn't too much of a Good Thing โ€” values from Cargo.toml like name, author, version, and description are injected into the --help text using the env!() macro.

    Unfortunately, we can't do this (yet) with const values. So const USAGE becomes let usage in the process.

    opened by StevenBlack 0
  • Github action cross compile

    Github action cross compile

    Hi little brother, I made this pull request to trigger a GitHub action at each tag and compile rmt.rs for macOS and Linux on many architectures. I recommend you review the GitHub action during the merge of squash my commits because I made many to test the GitHub action directly.

    The output artefact: image

    opened by AdilZouitine 0
  • Allow user to set cronjob for the emptying of trash can

    Allow user to set cronjob for the emptying of trash can

    Make the config.yml file look something like so:

    compression: true
    
    trash:
        max_size: 10000
        max_element: 10
        automatic_flush:
          time: something 
    

    The user should be able to set the cron either from a file, or via a cli option

    opened by HarrisonHemstreet 0
  • Encryption of items in the trash

    Encryption of items in the trash

    Add the encryption of the data in the recycle garbage can if the config file asks for it. https://github.com/AmineZouitine/rmt.rs/blob/main/config/config.yml Use: If you sell your computer but you forget to delete the recycle garbage can, the items can not be read

    enhancement good first issue 
    opened by AmineZouitine 0
  • Request sql improvement

    Request sql improvement

    File: https://github.com/AmineZouitine/rmt.rs/blob/main/src/data_manager.rs

    Some sql queries are not optimized, example :

    pub fn find_trash_item_by_id(connection: &Connection, is_test: bool, id: i32) -> TrashItem {
        find_all_trash_items(connection, is_test)
            .into_iter()
            .find(|trash_item| trash_item.id == id)
            .unwrap()
    }
    

    While a where could directly give us the item we want, without retrieving all of them

    Another example in the file https://github.com/AmineZouitine/rmt.rs/blob/main/src/input_manager.rs line 29

            data_manager::find_all_trash_items(connection, is_test).len()
    

    While a "get_element_count" function by spanking a select COUNT(*) could be faster

    enhancement good first issue 
    opened by AmineZouitine 0
  • Compression of data in the trash

    Compression of data in the trash

    Add an option to automatically compress the items in the recycle garbage can, allowing to reduce its size.

    For this, we can use the existing configuration file.

    enhancement good first issue 
    opened by AmineZouitine 0
  • Build crash. Requires fail

    Build crash. Requires fail

    + cargo build --release
        Updating crates.io index
    error: failed to select a version for the requirement `clap = "^4.0.13"`
    candidate versions found which didn't match: 3.2.22, 3.2.21, 3.2.20, ...
    location searched: crates.io index
    

    rmt 0.1.7 linux x86_64 cargo 1.59.0 rustc 1.59.0

    bug 
    opened by SergeyDjam 3
Releases(0.1.9)
Owner
Amine Zouitine
Hi ๐Ÿ‘จโ€๐Ÿ’ป Computer science student at Epita.
Amine Zouitine
A command line interface for trash written in Rust (WIP)

trashctl A command line interface for trash Features Add file to trash List files Permanently delete a file Restore file Empty the trash Documentation

0xMRTT 2 Nov 11, 2022
Rmatrix is similar to the cmatrix, but it wrote it in Rust.

Rmatrix is similar to the cmatrix, but it wrote it in Rust. Get up to 75% performance improvement compared to cmatrix.

null 8 Apr 8, 2022
JiaShiwen 12 Nov 5, 2022
Source code for our paper "Higher-order finite elements for embedded simulation"

Higher-order Finite Elements for Embedded Simulation This repository contains the source code used to produce the results for our paper: Longva, A., L

Interactive Computer Graphics 18 Sep 30, 2022
Save image from your clipboard ๐Ÿ“‹ as an image file directly from your command line! ๐Ÿ”ฅ

Clpy ?? Save copied image from clipboard as an image file directly from your command line! Note It works only on windows as of now. I'll be adding sup

Piyush Suthar 13 Nov 28, 2022
A git command to quickly save your local changes in case of earthquake !

git-eq (aka git earthquake) Earthquakes are part of the daily life in many countries like in Taiwan. git-eq is a simple git command to quickly save yo

Jรฉrรดme MEVEL 6 Dec 16, 2022
koyo is a cli tool that lets you run commands as another user. It is similar to doas or sudo.

koyo is a cli tool that lets you run commands as another user. It is similar to doas or sudo.

null 3 Nov 27, 2021
Simple calculator REPL, similar to bc(1), with syntax highlighting and persistent history

eva simple calculator REPL, similar to bc(1), with syntax highlighting and persistent history installation Homebrew $ brew install eva crates.io $ car

Akshay 632 Jan 4, 2023
argmax is a library that allows Rust applications to avoid Argument list too long errors (E2BIG) by providing a std::process::Command wrapper with a

argmax argmax is a library that allows Rust applications to avoid Argument list too long errors (E2BIG) by providing a std::process::Command wrapper w

David Peter 22 Nov 20, 2022
๐Ÿค– just is a handy way to save and run project-specific commands.

just just is a handy way to save and run project-specific commands. (้žๅฎ˜ๆ–นไธญๆ–‡ๆ–‡ๆกฃ,่ฟ™้‡Œ,ๅฟซ็œ‹่ฟ‡ๆฅ!) Commands, called recipes, are stored in a file called justfile

Casey Rodarmor 8.2k Jan 5, 2023
Save cli commands and fuzzy find them later

crow - cli command memorizer What is crow? | Installation | Usage | FAQ What is crow? crow (command row) is a CLI tool to help you memorize CLI comman

sandstorm 7 Feb 17, 2022
A diff-based data management language to implement unlimited undo, auto-save for games, and cloud-apps which needs to retain every change.

Docchi is a diff-based data management language to implement unlimited undo, auto-save for games, and cloud-apps which needs to save very often. User'

juzy 21 Sep 19, 2022
Create tasks and save notes offline from your terminal

Create tasks and save notes offline from your terminal

null 9 Dec 18, 2022
Save decryption/encryption and transfer utility for Automachef

automachef-save Automachef by HermesInteractive encrypts it's save files with the user's account ID (Steam, Epic) or a static key (GOG, Twitch). The I

null 2 Jul 2, 2022
Quickly save and retrieve values for shell scripts.

Quickly save and retrieve values for shell scripts.

Alex Andrade 2 Dec 15, 2022
Slay the Spire save deobfuscator / reobfuscator

SpireSaver This is a command-line Slay the Spire save file deobfuscator / reobfuscator that I threw together in a couple of hours. I used andrewsnyder

null 2 Oct 11, 2022
Start and stop system for applications to save your budget on hourly billing VPS.

Start and stop system (STT) Start and stop system for applications to save your budget on hourly billing VPS. Service A service consists of start/stop

The GregTech Team 3 Jan 12, 2023
Uses the cardano mini-protocols to receive every block and transaction, and save them to a configurable destination

cardano-slurp Connects to one or more cardano-node's, streams all available transactions, and saves them to disk (or to S3) in raw cbor format. Usage

Pi Lanningham 16 Jan 31, 2023
A command-line shell like fish, but POSIX compatible.

A command-line shell like fish, but POSIX compatible.

Seiya Nuta 813 Dec 29, 2022