Skip to content

Commit

Permalink
v20 Maintenance release
Browse files Browse the repository at this point in the history
This is a minor maintenance release focused on
improving the tooling and build process.

I apologize to any package maintainers that are
affected, and hope you agree with some of the
changes!

Tooling changes:
- Copyright info was updated
- The Rakefile has been replaced with a Justfile
- Ronn-ng has been replaced with scdoc

With these the build dependency on Ruby is now
gone!
The package.rb file remains to build DEBs
and RPMs with FPM. However I will no longer be
providing these myself. I don't think users
should be relying on these.

Code changes:
- Functions were all annotated with @safe or
  @trusted as applicable
- Version name information is again in dub.json

My hope is that by relying on D's safety features
we can make stronger guarantees about the program,
which helps long-term maintenance.

The version is now 20 and the version name is now
"Annette Birkin" from Resident Evil 2.
  • Loading branch information
rushsteve1 committed Feb 11, 2025
1 parent 2537f7b commit a34882f
Show file tree
Hide file tree
Showing 15 changed files with 243 additions and 290 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: dlang-community/setup-dlang@v2
with:
compiler: ldc-latest

- name: Test
run: rake test:coverage
run: just coverage

- name: Build
run: rake build:release:strip
run: just release

- name: Man Page with Ronn
- name: Man Page with Scdoc
run: |
sudo gem install ronn-ng
rake manpage
sudo apt install scdoc
just manpage
- name: Distro Packages
run: |
Expand All @@ -39,7 +39,7 @@ jobs:
name: "trash-d"
path: |
build/trash
build/trash.man
build/trash.1
- name: Upload Coverage Logs
uses: actions/upload-artifact@v4
Expand Down
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

36 changes: 36 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
build_dir := "./build"

default:
@just --list

all:
just release manpage package

build:
dub build

clean:
dub clean
rm -r {{build_dir}}

release:
dub build --build=release
strip {{build_dir}}/trash

test:
dub test

coverage:
mkdir -p {{build_dir}}/coverage
dub test --coverage
mv *.lst {build_dir}}/coverage

lint:
dub lint

format:
dub run dfmt -- -i source/**/*.d

manpage:
scdoc < MANUAL.scd > {{build_dir}}/trash.1

141 changes: 0 additions & 141 deletions MANUAL.md

This file was deleted.

144 changes: 144 additions & 0 deletions MANUAL.scd
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
TRASH(1)

# NAME

trash(1) - A near drop-in replacement for `rm` that uses the trash bin

The name of this software is "trash-d" however its executable
is simply called *trash*. This manual favors the latter, but the two
should be considered interchangeable.

# SYNOPSIS

trash [_option_]... _file_...

# DESCRIPTION

A near drop-in replacement for *rm*(1) that uses the FreeDesktop trash bin.
Written in the D programming language using only D's Phobos standard library.

The options and flags are intended to mirror *rm*'s closely, with some
additional long options for the *trash* specific features.

## Options

*-d*, *--dir*
: Remove empty directories.

*-r*, *-R*, *--recursive*
: Delete directories and their contents.

*-v*, *--verbose*
: Print more information.

*-i*, *--interactive*
: Ask before each deletion.

*-I*, *--interact-once*
: Ask before deleting 3 or more files, or deleting recursively

*-f*, *--force*
: Don't prompt and ignore errors.

*--version*
: Output the version and exit.

*--list*
: List out the files in the trash.

*--orphans*
: List orphaned files in the trash.

*--delete* _file_
: Delete a file from the trash.

*--restore* _file_
: Restore a file from the trash.

*--empty*
: Empty the trash bin.

*--rm* _files_...
: Escape hatch to permanently delete a file.

*-h*, *--help*
: This help information.

## Precedence

The *--help*, *--version*, *--list*, *--orphans*,
*--restore*, *--delete*, and *--empty* flags all cause the program
to short-circuit and perform only that operation and no others. Their
precedence is in that order exactly, and is intended to cause the least
destruction.

Therefore the command '`trash --empty --list`' will list the trash bin and NOT
empty it.

*Note:* Before version 11 trash-d followed a slightly incorrect precedence
order.

## Compatibility with *rm*(1)

One of trash-d's primary goals is near compatibility with the GNU *rm(1)*
tool. The keyword here is "near". The goal is not exact flag-for-flag
compatibility with *rm*, but you should be able to '`alias rm=trash`' and
not notice the difference. But since *rm* has different failure states and
error messages it can never be 100% compatible.

Additionally since there are a few different implementations of *rm(1)*
(BSDs and so on) that are all subtly incompatible with each other I can't
guarantee compatibility with all versions.

As of version 16 unknown options will throw an error. Prior to
version 16 unknown options were silently ignored.

As of version 17 trash-d will not follow symlinks recursively through
directories. This may in some cases be inconsistent with *rm* but errs on
the side of not deleting your files.

# ENVIRONMENT

*XDG_DATA_HOME*
This variable is used to determine where the default trash directory is for
this user as per the FreeDesktop specification.

*TRASH_D_DIR*
Override the trash directory to the specified path, useful for trashing on
removable devices.

# FILES

*$XDG_DATA_HOME/Trash*
Standard location of trash files and metadata as per the FreeDesktop
specification. Used in the absence of *$TRASH_D_DIR*.

*~/.local/share/Trash*
The fallback path used in the absence of both *$XDG_DATA_HOME* and
*$TRASH_D_DIR*.

# EXIT STATUS

*trash* exits with the status code 0 on success, and >0 if an error occurs.

# SEE ALSO

*rm*(1), *user-dirs.conf*(5)

# STANDARDS

By mimicking *rm* this utility is partially POSIX compliant however this is
*NOT* to be relied upon for any purpose.

trash-d is compliant with the FreeDesktop trash specification:
https://specifications.freedesktop.org/trash-spec/trashspec-latest.html

# AUTHOR

Steven vanZyl <rushsteve1@rushsteve1.us>

The up-to-date sources can be found at: https://github.com/rushsteve1/trash-d

# BUGS

https://github.com/rushsteve1/trash-d/issues
Loading

0 comments on commit a34882f

Please sign in to comment.