Skip to content

Commit

Permalink
Merge pull request #262 from alfonsoros88/del_new
Browse files Browse the repository at this point in the history
Add `new` method to instantiate Delete command
  • Loading branch information
utam0k authored Sep 20, 2021
2 parents 4392293 + bd323fd commit 13fe16f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/commands/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ pub struct Delete {
}

impl Delete {
/// instant Delete Command
///
/// This method is provided for those using `youki` as a library to enable the use of the
/// Delete command to remove containers.
pub fn new(container_id: String, force: bool) -> Self {
Self {
container_id,
force,
}
}

pub fn exec(&self, root_path: PathBuf, systemd_cgroup: bool) -> Result<()> {
log::debug!("start deleting {}", self.container_id);
// state of container is stored in a directory named as container id inside
Expand Down

0 comments on commit 13fe16f

Please sign in to comment.