All Projects → Bios-Marcel → wastebasket

Bios-Marcel / wastebasket

Licence: MPL-2.0 license
A crossplatform go library for moving files to the trashbin

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to wastebasket

Trash
Move files and directories to the trash
Stars: ✭ 2,293 (+7543.33%)
Mutual labels:  trash, delete
object.omit
Return a copy of an object without the given keys.
Stars: ✭ 79 (+163.33%)
Mutual labels:  remove, delete
rmfr
Node.js implementation of rm -fr – recursive removal of files and directories
Stars: ✭ 23 (-23.33%)
Mutual labels:  remove, delete
eliminate
Delete files and directories without all the bullshit.
Stars: ✭ 51 (+70%)
Mutual labels:  remove, delete
Node Fs Extra
Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
Stars: ✭ 8,142 (+27040%)
Mutual labels:  remove, delete
unimport
A linter, formatter for finding and removing unused import statements.
Stars: ✭ 119 (+296.67%)
Mutual labels:  remove
homeassistant-afvalwijzer
Provides sensors for some Dutch waste collectors
Stars: ✭ 119 (+296.67%)
Mutual labels:  trash
js-cleanup
Smart comment and whitespace cleaner for JavaScript-like files
Stars: ✭ 22 (-26.67%)
Mutual labels:  remove
lint-deps
Lint for unused or missing dependencies in your node.js projects. Customize with plugins or configuration.
Stars: ✭ 48 (+60%)
Mutual labels:  remove
rmw
a safe-remove utility for the command line
Stars: ✭ 48 (+60%)
Mutual labels:  trash
del-webpack-plugin
A file plugin help you remove old files after webpack (v5) bundling
Stars: ✭ 43 (+43.33%)
Mutual labels:  trash
wloader
Windows 10 PRO Activator - No more backdoors via loaders from China and neither you will need any crack anymore that is valid for a week or two. This is script is written for powershell/cmd. This script will also removing all bloatware from Windows 10. Edit the script after your needs.
Stars: ✭ 88 (+193.33%)
Mutual labels:  remove
VsCacheCleaner
🧹 Clear the Visual Studio solution cache, free up your disk space!
Stars: ✭ 69 (+130%)
Mutual labels:  trash
strip-markdown
plugin remove Markdown formatting
Stars: ✭ 84 (+180%)
Mutual labels:  remove
SharpLoader
🔮 [C#] Source code randomizer and compiler
Stars: ✭ 36 (+20%)
Mutual labels:  trash
detect-waste
AI to Combat Environmental Pollution - detecting plastic waste in the environment to combat environmental pollution and promote circular economy (Deep Learning, PyTorch)
Stars: ✭ 113 (+276.67%)
Mutual labels:  trash
nvidialinuxdriversaretrash.github.io
An aggregate void to yell into about Nvidia's terrible Linux drivers!
Stars: ✭ 20 (-33.33%)
Mutual labels:  trash
trash
Remove Command using a trash box.
Stars: ✭ 19 (-36.67%)
Mutual labels:  trash
osx-trash
Make Emacs' delete-by-moving-to-trash do what you expect it to do on OS X.
Stars: ✭ 22 (-26.67%)
Mutual labels:  trash
gulp-rev-delete-original
Delete the original file rewritten by gulp-rev.
Stars: ✭ 28 (-6.67%)
Mutual labels:  delete

Wastebasket

CI codecoverage

Wastebasket is a go library / CLI tool allowing you to interact with your system trashbin.

Dependencies

Golang

The library supports at least the 3 latest major Golang versions. Depending on your OS it might still work on an older version, but there are no guarantees.

Windows

There are no dependencies, it depends on the Shell32 API built into Windows.

No CGO required

Linux (Unix)

There are two (well, four) options you've got here. Wastebasket offers a native golang implementation of the FreeDesktop Trash specification.

Additionally, the custom implementation should also work for systems such as BSD and its derivatives. However, this has not been tested and I do not plan on doing so, simply because GitHub does not currently support running tests on any BSD derivatives.

If anyone is willing to host a custom runner (which I think is possible), then I'd be open to this though.

No CGO required

Mac OS

The only dependency is Finder, which is installed by default.

There are plans for a better implementation, that uses the Objective-C API provided by Mac OS, resulting in most likely much better performance.

No CGO required (Might change in the future)

Library usage

Grab it via

go get github.com/Bios-Marcel/wastebasket

and you are ready to go.

Minimal Go example that creates a file, deletes it and empties the trashbin:

package main

import (
    "fmt"
    "os"

    "github.com/Bios-Marcel/wastebasket"
)

func main() {
    os.WriteFile("test.txt", []byte("Test"), os.ModePerm)
    fmt.Println(wastebasket.Trash("test.txt"))
    wastebasket.Empty()
}

CLI usage

Wastebasket can also be used as a commandline interface. You can build executables for each subcommand (such as empty) separately, or build wastebasket as a whole.

In order to do so, run

go build ./cmd/CMD

where CMD is whichever command you want to build.

Autocompletion

The CLI offers autocompletion for flags and pre-defined arguments.

Bash; Write the following into your bash profile:

source <(wastebasket completion bash)

Additionally, completion is supported for zsh, powershell and fish. For information, see Cobra shell completions

Benchmarks

Run benchmarks using:

go test -bench=.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].