Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename executable to trashy (#104) #106

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ jobs:
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mv "target/${{ matrix.target }}/release/trash.exe" "trash-${{ matrix.target }}.exe"
echo "ASSET=trash-${{ matrix.target }}.exe" >> $GITHUB_ENV
mv "target/${{ matrix.target }}/release/trashy.exe" "trashy-${{ matrix.target }}.exe"
echo "ASSET=trashy-${{ matrix.target }}.exe" >> $GITHUB_ENV
else
mv "target/${{ matrix.target }}/release/trash" "trash"
tar czf trash-${{ matrix.target }}.tar.gz trash
echo "ASSET=trash-${{ matrix.target }}.tar.gz" >> $GITHUB_ENV
mv "target/${{ matrix.target }}/release/trashy" "trashy"
tar czf trashy-${{ matrix.target }}.tar.gz trashy
echo "ASSET=trashy-${{ matrix.target }}.tar.gz" >> $GITHUB_ENV
fi

- name: Upload artifact
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Features

- `trash restore` will pull up an interactive prompt if no arguments are given
- `trashy restore` will pull up an interactive prompt if no arguments are given
- upgrade to clap v4

## Bugfixes
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rust-version = "1.62"

[[bin]]
path = "src/main.rs"
name = "trash"
name = "trashy"

[dependencies]
clap_mangen = "0.2.9"
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Quick links:

## Features

- easy to use, just run `trash PATH`
- easy to use, just run `trashy put PATH`
- recursive by default, without having the issues
- beautiful output
- colorized paths (similar to *fd*)
Expand All @@ -30,28 +30,28 @@ Quick links:
### Trash a path

```bash
$ trash first second third
$ trashy first second third
```

This is just sugar for

```bash
$ trash put first second third
$ trashy put first second third
```

### List items in the trash

```bash
$ trash list
$ trashy list
```

### Restore or empty some files

```bash
$ trash restore first second
$ trashy restore first second
```
```bash
$ trash empty first second third
$ trashy empty first second third
```

The `restore` and `empty` subcommands both take very similar arguments and flags.
Expand All @@ -63,11 +63,11 @@ Use the `-m` option to interpret them differently.
### Restore or empty all files

```bash
$ trash restore --all
$ trashy restore --all
```

```bash
$ trash empty --all
$ trashy empty --all
```

## Integrations
Expand All @@ -77,13 +77,13 @@ $ trash empty --all
Restore with fzf

```bash
trash list | fzf --multi | awk '{$1=$1;print}' | rev | cut -d ' ' -f1 | rev | xargs trash restore --match=exact --force
trashy list | fzf --multi | awk '{$1=$1;print}' | rev | cut -d ' ' -f1 | rev | xargs trashy restore --match=exact --force
```

Empty with fzf

```bash
trash list | fzf --multi | awk '{$1=$1;print}' | rev | cut -d ' ' -f1 | rev | xargs trash empty --match=exact --force
trashy list | fzf --multi | awk '{$1=$1;print}' | rev | cut -d ' ' -f1 | rev | xargs trashy empty --match=exact --force
```

## Installation
Expand Down Expand Up @@ -136,7 +136,7 @@ Time (abs ≡): 65.849 s [User: 54.383 s, System: 11.370 s]
Now with `trashy`

```
hyperfine -M 1 'fd -t f --threads 1 -x trash put'
hyperfine -M 1 'fd -t f --threads 1 -x trashy put'
```

```
Expand All @@ -158,7 +158,7 @@ Range (min … max): 375.9 ms … 412.0 ms 10 runs


```
hyperfine 'trash list'
hyperfine 'trashy list'
```

```
Expand All @@ -174,9 +174,9 @@ Range (min … max): 175.6 ms … 181.0 ms 16 runs

No, see this [issue](https://github.com/Byron/trash-rs/issues/8)

### Should I alias rm='trash put'?
### Should I alias rm='trashy put'?

You should not. The alias will not be present on other systems and habits are really hard to break. An alternative is to alias `trash put` to `rt` or `tp`.
You should not. The alias will not be present on other systems and habits are really hard to break. An alternative is to alias `trashy put` to `rt` or `tp`.

## License

Expand Down
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use command::Command;
version,
about,
long_about = None,
after_help = "Note: `trash -h` prints a short and concise overview while `trash --help` gives all \
after_help = "Note: `trashy -h` prints a short and concise overview while `trashy --help` gives all \
details.",
)]
pub struct Args {
Expand Down
2 changes: 1 addition & 1 deletion src/app/command/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct Args {

impl Args {
pub fn run(&self) -> Result<()> {
clap_complete::generate(self.shell, &mut app::Args::command(), "trash", &mut io::stdout());
clap_complete::generate(self.shell, &mut app::Args::command(), "trashy", &mut io::stdout());
Ok(())
}
}
6 changes: 3 additions & 3 deletions src/app/command/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@
/// This option puts the oldest trash item at the bottom.
/// This will also affect 'empty' or 'restore' if used in either command.
/// Examples:
/// 'trash empty --rev -n=10' will delete 10 oldest trash items are deleted.
/// 'trashy empty --rev -n=10' will delete 10 oldest trash items are deleted.
#[arg(long, verbatim_doc_comment)]
pub rev: bool,

/// Show 'n' maximum trash items
///
/// This will also affect 'empty' or 'restore' if used in either command.
/// Examples:
/// 'trash list -n=10' will list the ten newest trashed items.
/// 'trash restore -n=10' will list restore the ten newest trashed items.
/// 'trashy list -n=10' will list the ten newest trashed items.
/// 'trashy restore -n=10' will list restore the ten newest trashed items.
#[arg(short = 'n', long = "max", verbatim_doc_comment)]
pub max: Option<NonZeroU32>,
}
Expand Down Expand Up @@ -272,10 +272,10 @@
}

pub fn display_item_date(item: &TrashItem, time_display_mode: TimeDisplayMode) -> String {
let datetime = Local.timestamp(item.time_deleted, 0);

Check warning on line 275 in src/app/command/list.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead

Check warning on line 275 in src/app/command/list.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead

Check warning on line 275 in src/app/command/list.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead

Check warning on line 275 in src/app/command/list.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead
match time_display_mode {
TimeDisplayMode::Precise => {
format!("{}", Local.timestamp(item.time_deleted, 0).format("%d/%m/%Y %H:%M"))

Check warning on line 278 in src/app/command/list.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead

Check warning on line 278 in src/app/command/list.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead

Check warning on line 278 in src/app/command/list.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead

Check warning on line 278 in src/app/command/list.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead
}
TimeDisplayMode::Imprecise => {
let humantime = chrono_humanize::HumanTime::from(datetime);
Expand Down
2 changes: 1 addition & 1 deletion src/app/command/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct Ranges {
/// Filter by ranges
///
/// This should be used to restore specific items.
/// To find the ranges, look at the 'i' column in the table shown by 'trash list'.
/// To find the ranges, look at the 'i' column in the table shown by 'trashy list'.
/// The option is called '--ranges' but you can also use individual indices by just typing out the number.
/// Ranges are zero based, inclusive at the start, and exclusive at the end, just like rust ranges.
/// Examples:
Expand Down
4 changes: 2 additions & 2 deletions src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
/// This will filter using a pattern type specified in '--match'.
/// Using <PATTERNS> and '--match' gives the same effect as passing one of the pattern options explicitly.
/// So for example
/// trash restore '~/projects/**' '~/builds/**' --match=glob
/// trashy restore '~/projects/**' '~/builds/**' --match=glob
/// is the same as
/// trash restore --glob='~/project/**' --glob='~/builds/**'
/// trashy restore --glob='~/project/**' --glob='~/builds/**'
#[arg(verbatim_doc_comment)]
pub patterns: Vec<String>,

Expand Down Expand Up @@ -165,7 +165,7 @@
Filter::PatternSet(patterns) => {
patterns.is_match(&item.original_path().to_string_lossy())
}
Filter::Time(time_filter) => time_filter.is_match(Utc.timestamp(item.time_deleted, 0)),

Check warning on line 168 in src/filter.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead

Check warning on line 168 in src/filter.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead

Check warning on line 168 in src/filter.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead

Check warning on line 168 in src/filter.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest)

use of deprecated method `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead
Filter::Directories(directories) => {
directories.iter().all(|p| item.original_path().starts_with(p))
}
Expand Down Expand Up @@ -245,7 +245,7 @@
.ok()
.or_else(|| {
NaiveDate::parse_from_str(s, "%F")
.map(|nd| nd.and_hms(0, 0, 0))

Check warning on line 248 in src/filter.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead

Check warning on line 248 in src/filter.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead

Check warning on line 248 in src/filter.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead

Check warning on line 248 in src/filter.rs

View workflow job for this annotation

GitHub Actions / test (windows-latest)

use of deprecated method `chrono::NaiveDate::and_hms`: use `and_hms_opt()` instead
.ok()
.and_then(|ndt| Local.from_local_datetime(&ndt).single())
})
Expand Down
Loading