This commit is contained in:
Michael Zhang 2019-12-14 13:26:29 -06:00
parent c4097ae1a3
commit 72d3b9c993
No known key found for this signature in database
GPG key ID: 5BAEFE5D04F0CE6C
4 changed files with 51 additions and 49 deletions

50
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,50 @@
on:
push:
tags:
- 'v*'
name: Create Release
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Build project
run: |
rustup target add x86_64-unknown-linux-musl
cargo build --release
cargo build --release --target x86_64-unknown-linux-musl
zip --junk-paths release.zip garbage-*
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/release/garbage
asset_name: garbage
asset_content_type: application/octet-stream
- name: Upload Musl Release Asset
id: upload-musl-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/x86_64-unknown-linux-musl/release/garbage
asset_name: garbage-musl
asset_content_type: application/octet-stream

View file

@ -4,7 +4,6 @@ on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:

View file

@ -1,6 +1,6 @@
[package]
name = "garbage"
version = "0.1.2"
version = "0.1.3"
authors = ["Michael Zhang <iptq@protonmail.com>"]
description = "cli tool for interacting with the freedesktop trashcan"
license = "MIT"

View file

@ -28,53 +28,6 @@ pub fn put(paths: Vec<PathBuf>, recursive: bool) -> Result<()> {
Ok(())
}
// fn put_single(path: impl AsRef<Path>, recursive: bool) -> Result<()> {
// let current_dir = env::current_dir()?;
// let path = path.as_ref().canonicalize()?;
// ensure!(
// path == current_dir
// || (current_dir.parent().is_some() && path == current_dir.parent().unwrap()),
// Error::CannotTrashDotDirs
// );
// // if path.is_dir() && !recursive {
// // error!("cannot trash directories without --recursive");
// // return Ok(());
// // }
// let now = Local::now();
// let elapsed = now.timestamp_millis();
// let home_trash = TrashDir::get_home_trash();
// let file_name = format!(
// "{}.{}",
// elapsed,
// path.file_name().unwrap().to_str().unwrap()
// );
// let trash_file_path = home_trash.files_dir()?.join(&file_name);
// let trash_info_path = home_trash.info_dir()?.join(file_name + ".trashinfo");
// let trash_info = TrashInfo {
// path: path.clone(),
// deletion_date: now,
// deleted_path: trash_file_path.clone(),
// info_path: trash_info_path.clone(),
// };
// {
// let trash_info_file = File::create(trash_info_path)?;
// trash_info.write(&trash_info_file)?;
// }
// let result = fs::rename(&path, &trash_file_path);
// if result.is_err() {
// fs::copy(&path, &trash_file_path)?;
// }
// Ok(())
// }
pub enum DeletionStrategy {
Copy,
Topdir,