-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20428f4
commit 4896ad6
Showing
9 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
release: | ||
name: release ${{ matrix.target }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: [x86_64-pc-windows-gnu, x86_64-unknown-linux-musl] | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Compile and release | ||
uses: rust-build/rust-build.action@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RUSTTARGET: ${{ matrix.target }} | ||
EXTRA_FILES: "README.md LICENSE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "deleter" | ||
version = "0.1.0" | ||
authors = ["Himadu2000 <[email protected]>"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# Deleter | ||
A delete program. Use with caution! | ||
|
||
A folder delete program. Use with caution! | ||
|
||
# How to use | ||
|
||
open deleter.exe, | ||
enter folder path to delete, Ex: C:/hello | ||
enter yes and voilà . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use std::io; | ||
|
||
pub fn request_confirmation(location: &str) -> String { | ||
println!("Are you sure delete, {} | Write (yes)", location); | ||
let mut anwser = String::new(); | ||
io::stdin() | ||
.read_line(&mut anwser) | ||
.expect("Failed to read line"); | ||
let anwser = anwser.trim(); | ||
return anwser.to_string(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::fs; | ||
|
||
pub fn delete(path: &str) { | ||
match remove_directory(path) { | ||
Ok(_value) => { | ||
println!("Your folder: {} has been deleted!", path); | ||
} | ||
Err(error) => { | ||
println!("{}", error) | ||
} | ||
} | ||
} | ||
|
||
fn remove_directory(path: &str) -> std::io::Result<()> { | ||
fs::remove_dir_all(path)?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use std::process; | ||
mod confirm; | ||
mod delete; | ||
mod path; | ||
|
||
fn main() { | ||
loop { | ||
let path = path::get_path(); | ||
if path == "exit" { | ||
process::exit(0); | ||
} | ||
let confirmation = confirm::request_confirmation(&path); | ||
if confirmation == "yes" { | ||
delete::delete(&path); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use std::io; | ||
|
||
pub fn get_path() -> String { | ||
println!("Please input your folder location to delete. Write exit to quit."); | ||
|
||
let mut location = String::new(); | ||
|
||
io::stdin() | ||
.read_line(&mut location) | ||
.expect("Failed to read line"); | ||
|
||
let location = location.trim(); | ||
return location.to_string(); | ||
} |