File tree Expand file tree Collapse file tree 4 files changed +35
-4
lines changed Expand file tree Collapse file tree 4 files changed +35
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " nerdctl" ,
3- "version" : " 0.0.3 " ,
3+ "version" : " 0.0.6 " ,
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 @@ -65,6 +65,10 @@ export interface LogsCommandFlags extends GlobalFlags {
6565 until ?: string ;
6666}
6767
68+ export interface StopCommandFlags extends GlobalFlags {
69+ time ?: string ;
70+ }
71+
6872export interface RmCommandFlags extends GlobalFlags {
6973 force ?: boolean ;
7074 volumes ?: boolean ;
Original file line number Diff line number Diff line change @@ -76,7 +76,14 @@ export default abstract class BaseBackend {
7676 flags ?: RunCommandFlags
7777 ) : Promise < ExecResult | string > ;
7878
79- abstract rm ( container : string , flags ?: RmCommandFlags ) : Promise < ShellString > ;
79+ abstract stop (
80+ container : string | string [ ] ,
81+ flags ?: RmCommandFlags
82+ ) : Promise < ShellString > ;
83+ abstract rm (
84+ container : string | string [ ] ,
85+ flags ?: RmCommandFlags
86+ ) : Promise < ShellString > ;
8087
8188 abstract pullImage ( image : string ) : Promise < ChildProcess > ;
8289 abstract getImages ( ) : Promise < ImageResult [ ] > ;
Original file line number Diff line number Diff line change 22 LogsCommandFlags ,
33 RmCommandFlags ,
44 RunCommandFlags ,
5+ StopCommandFlags ,
56} from "@/types/container" ;
67
78import BaseBackend from "./base" ;
@@ -47,9 +48,28 @@ export default class LimaBackend extends BaseBackend {
4748 } ) ;
4849 }
4950
50- async rm ( container : string , flags ?: RmCommandFlags ) : Promise < ShellString > {
51+ async stop (
52+ container : string | string [ ] ,
53+ flags ?: StopCommandFlags
54+ ) : Promise < ShellString > {
55+ const containers = Array . isArray ( container )
56+ ? container . join ( " " )
57+ : container ;
5158 return ( await this . exec (
52- `${ this . container } rm ${ this . mergeFlags ( flags ) } ${ container } ` ,
59+ `${ this . container } stop ${ this . mergeFlags ( flags ) } ${ containers } ` ,
60+ { async : false }
61+ ) ) as ShellString ;
62+ }
63+
64+ async rm (
65+ container : string | string [ ] ,
66+ flags ?: RmCommandFlags
67+ ) : Promise < ShellString > {
68+ const containers = Array . isArray ( container )
69+ ? container . join ( " " )
70+ : container ;
71+ return ( await this . exec (
72+ `${ this . container } rm ${ this . mergeFlags ( flags ) } ${ containers } ` ,
5373 { async : false }
5474 ) ) as ShellString ;
5575 }
You can’t perform that action at this time.
0 commit comments