File tree Expand file tree Collapse file tree 5 files changed +26
-14
lines changed Expand file tree Collapse file tree 5 files changed +26
-14
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " nerdctl" ,
3- "version" : " 0.0.2 " ,
3+ "version" : " 0.0.3 " ,
44 "main" : " dist/index.js" ,
55 "types" : " dist/index.d.ts" ,
66 "description" : " Node wrapper for nerdctl" ,
Original file line number Diff line number Diff line change 1+ import { factory } from ".." ;
2+
3+ describe ( "container" , ( ) => {
4+ const engine = factory ( ) ;
5+ const IMAGE = "hello-world" ;
6+ const NAME = "hello" ;
7+
8+ test ( "rm" , async ( ) => {
9+ await engine . run ( IMAGE , { name : NAME , detach : true } ) ;
10+ const result = await engine . rm ( NAME , { force : true } ) ;
11+
12+ expect ( result . code ) . toEqual ( 0 ) ;
13+ } ) ;
14+ } ) ;
Original file line number Diff line number Diff line change @@ -65,4 +65,7 @@ export interface LogsCommandFlags extends GlobalFlags {
6565 until ?: string ;
6666}
6767
68- export interface ContainerCommandFlags extends GlobalFlags { }
68+ export interface RmCommandFlags extends GlobalFlags {
69+ force ?: boolean ;
70+ volumes ?: boolean ;
71+ }
Original file line number Diff line number Diff line change 11import { Architecture , ExecResult } from "@/types" ;
2- import { ContainerCommandFlags , RunCommandFlags } from "@/types/container " ;
3- import { ExecOptions , exec } from "shelljs " ;
2+ import { ExecOptions , ShellString , exec } from "shelljs " ;
3+ import { RmCommandFlags , RunCommandFlags } from "@/types/container " ;
44
55import { ChildProcess } from "child_process" ;
66import { GlobalFlags } from "@/types/global" ;
@@ -76,10 +76,7 @@ export default abstract class BaseBackend {
7676 flags ?: RunCommandFlags
7777 ) : Promise < ExecResult | string > ;
7878
79- abstract rm (
80- container : string ,
81- flags ?: ContainerCommandFlags
82- ) : Promise < ChildProcess > ;
79+ abstract rm ( container : string , flags ?: RmCommandFlags ) : Promise < ShellString > ;
8380
8481 abstract pullImage ( image : string ) : Promise < ChildProcess > ;
8582 abstract getImages ( ) : Promise < ImageResult [ ] > ;
Original file line number Diff line number Diff line change 11import {
2- ContainerCommandFlags ,
32 LogsCommandFlags ,
3+ RmCommandFlags ,
44 RunCommandFlags ,
55} from "@/types/container" ;
66
@@ -9,6 +9,7 @@ import { ChildProcess } from "child_process";
99import { ExecResult } from "@/types" ;
1010import { ImageResult } from "@/types/images" ;
1111import { LoginCommandFlags } from "@/types/registry" ;
12+ import { ShellString } from "shelljs" ;
1213
1314export default class LimaBackend extends BaseBackend {
1415 async init ( ) : Promise < void > { }
@@ -46,14 +47,11 @@ export default class LimaBackend extends BaseBackend {
4647 } ) ;
4748 }
4849
49- async rm (
50- container : string ,
51- flags ?: ContainerCommandFlags
52- ) : Promise < ChildProcess > {
50+ async rm ( container : string , flags ?: RmCommandFlags ) : Promise < ShellString > {
5351 return ( await this . exec (
5452 `${ this . container } rm ${ this . mergeFlags ( flags ) } ${ container } ` ,
5553 { async : false }
56- ) ) as ChildProcess ;
54+ ) ) as ShellString ;
5755 }
5856
5957 async logs (
You can’t perform that action at this time.
0 commit comments