Skip to content

Commit

Permalink
rm feature skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
cyqsimon committed Apr 3, 2023
1 parent 2b1510d commit 82dd826
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ pub struct CliArgs {
#[arg(short = 'o', long = "overwrite-files")]
pub overwrite_files: bool,

/// Enable file and directory deletion
#[arg(short = 'R', long = "enable-rm")]
pub enable_rm: bool,

/// Enable uncompressed tar archive generation
#[arg(short = 'r', long = "enable-tar")]
pub enable_tar: bool,
Expand Down
4 changes: 4 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ pub struct MiniserveConfig {
/// Enable upload to override existing files
pub overwrite_files: bool,

/// Enable file and directory deletion
pub enable_rm: bool,

/// If false, creation of uncompressed tar archives is disabled
pub tar_enabled: bool,

Expand Down Expand Up @@ -265,6 +268,7 @@ impl MiniserveConfig {
})
.collect(),
uploadable_media_type,
enable_rm: args.enable_rm,
tar_enabled: args.enable_tar,
tar_gz_enabled: args.enable_tar_gz,
zip_enabled: args.enable_zip,
Expand Down
5 changes: 5 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ mod file_utils;
mod listing;
mod pipe;
mod renderer;
mod rm;

use crate::config::MiniserveConfig;
use crate::errors::ContextualError;
Expand Down Expand Up @@ -328,6 +329,10 @@ fn configure_app(app: &mut web::ServiceConfig, conf: &MiniserveConfig) {
// Allow file upload
app.service(web::resource("/upload").route(web::post().to(file_upload::upload_file)));
}
if conf.enable_rm {
// Allow file and directory deletion
todo!();
}
// Handle directories
app.service(dir_service());
}
Expand Down
Empty file added src/rm.rs
Empty file.

0 comments on commit 82dd826

Please sign in to comment.