@@ -7,8 +7,7 @@ Docker Command:
77 pgpm docker <subcommand> [OPTIONS]
88
99 Manage Docker containers for local development.
10- PostgreSQL is always started by default. Additional services can be
11- included with the --include flag.
10+ PostgreSQL is always started by default.
1211
1312Subcommands:
1413 start Start containers
@@ -23,23 +22,22 @@ PostgreSQL Options:
2322 --password <pass> PostgreSQL password (default: password)
2423 --shm-size <size> Shared memory size for container (default: 2g)
2524
25+ Additional Services:
26+ --minio Include MinIO S3-compatible object storage (port 9000)
27+
2628General Options:
2729 --help, -h Show this help message
2830 --recreate Remove and recreate containers on start
29- --include <svc> Include additional service (can be repeated)
30-
31- Available Additional Services:
32- minio MinIO S3-compatible object storage (port 9000)
3331
3432Examples:
3533 pgpm docker start Start PostgreSQL only
36- pgpm docker start --include minio Start PostgreSQL + MinIO
34+ pgpm docker start --minio Start PostgreSQL + MinIO
3735 pgpm docker start --port 5433 Start on custom port
3836 pgpm docker start --shm-size 4g Start with 4GB shared memory
3937 pgpm docker start --recreate Remove and recreate containers
40- pgpm docker start --recreate --include minio Recreate PostgreSQL + MinIO
38+ pgpm docker start --recreate --minio Recreate PostgreSQL + MinIO
4139 pgpm docker stop Stop PostgreSQL
42- pgpm docker stop --include minio Stop PostgreSQL + MinIO
40+ pgpm docker stop --minio Stop PostgreSQL + MinIO
4341 pgpm docker ls List services and status
4442` ;
4543
@@ -315,21 +313,10 @@ async function stopService(service: ServiceDefinition): Promise<void> {
315313 await stopContainer ( service . name ) ;
316314}
317315
318- function parseInclude ( args : Partial < Record < string , any > > ) : string [ ] {
319- const include = args . include ;
320- if ( ! include ) return [ ] ;
321- if ( Array . isArray ( include ) ) return include as string [ ] ;
322- if ( typeof include === 'string' ) return [ include ] ;
323- return [ ] ;
324- }
325-
326- function resolveIncludedServices ( includeNames : string [ ] ) : ServiceDefinition [ ] {
316+ function resolveServiceFlags ( args : Partial < Record < string , any > > ) : ServiceDefinition [ ] {
327317 const services : ServiceDefinition [ ] = [ ] ;
328- for ( const name of includeNames ) {
329- const service = ADDITIONAL_SERVICES [ name ] ;
330- if ( ! service ) {
331- console . warn ( `⚠️ Unknown service: "${ name } ". Available: ${ Object . keys ( ADDITIONAL_SERVICES ) . join ( ', ' ) } ` ) ;
332- } else {
318+ for ( const [ key , service ] of Object . entries ( ADDITIONAL_SERVICES ) ) {
319+ if ( args [ key ] === true || typeof args [ key ] === 'string' ) {
333320 services . push ( service ) ;
334321 }
335322 }
@@ -350,7 +337,7 @@ async function listServices(): Promise<void> {
350337 console . log ( ' postgres constructiveio/postgres-plus:18 \x1b[90m(docker not available)\x1b[0m' ) ;
351338 }
352339
353- console . log ( '\n Additional (use --include <name>):' ) ;
340+ console . log ( '\n Additional (use --<name> flag ):' ) ;
354341
355342 for ( const [ key , service ] of Object . entries ( ADDITIONAL_SERVICES ) ) {
356343 if ( dockerAvailable ) {
@@ -392,8 +379,7 @@ export default async (
392379 const password = ( args . password as string ) || 'password' ;
393380 const shmSize = ( args [ 'shm-size' ] as string ) || ( args . shmSize as string ) || '2g' ;
394381 const recreate = args . recreate === true ;
395- const includeNames = parseInclude ( args ) ;
396- const includedServices = resolveIncludedServices ( includeNames ) ;
382+ const includedServices = resolveServiceFlags ( args ) ;
397383
398384 switch ( subcommand ) {
399385 case 'start' :
0 commit comments