easy-containers 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ .npmignore +13 -0
- package/Examples.md +101 -0
- package/Project structure.md +82 -0
- package/README.md +96 -0
- package/bin/cli.js +281 -0
- package/package.json +46 -0
- package/src/commands/config.js +339 -0
- package/src/commands/down.js +33 -0
- package/src/commands/download.js +23 -0
- package/src/commands/exec.js +93 -0
- package/src/commands/help.js +44 -0
- package/src/commands/index.js +17 -0
- package/src/commands/init.js +223 -0
- package/src/commands/list.js +149 -0
- package/src/commands/logs.js +76 -0
- package/src/commands/pull.js +38 -0
- package/src/commands/restart.js +45 -0
- package/src/commands/search.js +68 -0
- package/src/commands/show.js +116 -0
- package/src/commands/status.js +82 -0
- package/src/commands/up.js +29 -0
- package/src/commands/validate.js +151 -0
- package/src/constants/repository.js +12 -0
- package/src/utils/config.js +148 -0
- package/src/utils/docker.js +140 -0
- package/src/utils/downloader.js +478 -0
package/ .npmignore
ADDED
package/Examples.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Easy Containers CLI Examples
|
|
2
|
+
|
|
3
|
+
## 1. Start and stop a service
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
easy up postgres
|
|
7
|
+
easy status
|
|
8
|
+
easy down postgres
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 2. Download first, then run
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
easy download redis
|
|
15
|
+
easy up redis
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 3. List installed and available services
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
easy list
|
|
22
|
+
easy list --all
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 4. Search services
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
easy search kafka
|
|
29
|
+
easy search sql
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 5. View logs
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Last lines
|
|
36
|
+
easy logs postgres
|
|
37
|
+
|
|
38
|
+
# Follow live
|
|
39
|
+
easy logs postgres --follow
|
|
40
|
+
|
|
41
|
+
# Last 20 lines
|
|
42
|
+
easy logs postgres --tail 20
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 6. Check and inspect configuration
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
easy show postgres
|
|
49
|
+
easy validate postgres
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 7. Manage environment values
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Interactive config
|
|
56
|
+
easy config postgres
|
|
57
|
+
|
|
58
|
+
# Edit .env in editor
|
|
59
|
+
easy config postgres --edit
|
|
60
|
+
|
|
61
|
+
# Show current values
|
|
62
|
+
easy config postgres --show
|
|
63
|
+
|
|
64
|
+
# Reset from sample
|
|
65
|
+
easy config postgres --reset
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 8. Run command inside container
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Open shell
|
|
72
|
+
easy exec postgres
|
|
73
|
+
|
|
74
|
+
# Run direct command
|
|
75
|
+
easy exec postgres psql -U postgres
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 9. Update and restart
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
easy pull postgres
|
|
82
|
+
easy restart postgres
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 10. Create a new local service template
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
easy init myapp
|
|
89
|
+
easy init mydb --template database
|
|
90
|
+
easy up myapp
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 11. Useful flow for daily use
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
easy list
|
|
97
|
+
easy up redis
|
|
98
|
+
easy logs redis --follow
|
|
99
|
+
# Ctrl+C to stop log stream
|
|
100
|
+
easy down redis
|
|
101
|
+
```
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Easy Containers CLI Project Structure
|
|
2
|
+
|
|
3
|
+
This file explains what each main folder does.
|
|
4
|
+
|
|
5
|
+
## CLI folder layout
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
cli/
|
|
9
|
+
├── bin/
|
|
10
|
+
│ └── cli.js
|
|
11
|
+
├── src/
|
|
12
|
+
│ ├── commands/
|
|
13
|
+
│ ├── constants/
|
|
14
|
+
│ └── utils/
|
|
15
|
+
├── README.md
|
|
16
|
+
├── Examples.md
|
|
17
|
+
├── Project structure.md
|
|
18
|
+
└── package.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Folder details
|
|
22
|
+
|
|
23
|
+
### `bin/`
|
|
24
|
+
|
|
25
|
+
- `cli.js`: Program entry point.
|
|
26
|
+
- Defines all command routes using Commander.
|
|
27
|
+
|
|
28
|
+
### `src/commands/`
|
|
29
|
+
|
|
30
|
+
Each file maps to one CLI command.
|
|
31
|
+
|
|
32
|
+
- `up.js`: start service
|
|
33
|
+
- `down.js`: stop service
|
|
34
|
+
- `list.js`: list installed services (and available with `--all`)
|
|
35
|
+
- `download.js`: download service files
|
|
36
|
+
- `show.js`: show service details
|
|
37
|
+
- `status.js`: show running containers
|
|
38
|
+
- `logs.js`: show service logs
|
|
39
|
+
- `restart.js`: restart service
|
|
40
|
+
- `pull.js`: pull updated images
|
|
41
|
+
- `exec.js`: run command in container
|
|
42
|
+
- `config.js`: manage `.env`
|
|
43
|
+
- `validate.js`: validate compose config
|
|
44
|
+
- `search.js`: search available services
|
|
45
|
+
- `init.js`: create new local template
|
|
46
|
+
- `help.js`: custom help output
|
|
47
|
+
- `index.js`: exports all command handlers
|
|
48
|
+
|
|
49
|
+
### `src/utils/`
|
|
50
|
+
|
|
51
|
+
Shared helper logic used by commands.
|
|
52
|
+
|
|
53
|
+
- `docker.js`: runs docker and docker-compose commands, docker checks
|
|
54
|
+
- `config.js`: service paths and available-services lookup
|
|
55
|
+
- `downloader.js`: downloads service folder from repository
|
|
56
|
+
|
|
57
|
+
### `src/constants/`
|
|
58
|
+
|
|
59
|
+
- `repository.js`: repository URL, branch, and services path constants
|
|
60
|
+
|
|
61
|
+
## Runtime location
|
|
62
|
+
|
|
63
|
+
When the CLI runs, service files are stored in:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
~/.easy-containers/services/
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Typical command flow
|
|
70
|
+
|
|
71
|
+
For `easy up postgres`:
|
|
72
|
+
|
|
73
|
+
1. `bin/cli.js` receives command
|
|
74
|
+
2. `src/commands/up.js` runs
|
|
75
|
+
3. `src/utils/downloader.js` ensures service exists locally
|
|
76
|
+
4. `src/utils/docker.js` runs `docker-compose up -d`
|
|
77
|
+
|
|
78
|
+
For `easy list --all`:
|
|
79
|
+
|
|
80
|
+
1. `src/commands/list.js` runs
|
|
81
|
+
2. Installed services are read from local path
|
|
82
|
+
3. Available services are fetched via `src/utils/config.js`
|
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Easy Containers CLI
|
|
2
|
+
|
|
3
|
+
Easy Containers is a command line tool to manage Docker services quickly.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Docker running on your machine
|
|
8
|
+
- Docker Compose available in your PATH
|
|
9
|
+
- Node.js 14+
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git clone https://github.com/arjavdongaonkar/easy-containers.git
|
|
15
|
+
cd easy-containers/cli
|
|
16
|
+
npm install
|
|
17
|
+
npm link
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Basic usage
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
easy <command> [service] [options]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Run help anytime:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
easy help
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Commands
|
|
33
|
+
|
|
34
|
+
### Service commands
|
|
35
|
+
|
|
36
|
+
- `easy download <service>`: Download service files from repository
|
|
37
|
+
- `easy up <service>`: Start a service
|
|
38
|
+
- `easy down <service>`: Stop a service
|
|
39
|
+
- `easy restart <service>`: Restart a service
|
|
40
|
+
- `easy pull <service>`: Pull latest image updates
|
|
41
|
+
- `easy logs <service>`: Show logs for a service
|
|
42
|
+
- `easy show <service>`: Show service details from compose file
|
|
43
|
+
- `easy exec <service> [command...]`: Run a command inside running container
|
|
44
|
+
- `easy config <service>`: Manage `.env` values
|
|
45
|
+
- `easy validate <service>`: Validate compose configuration
|
|
46
|
+
|
|
47
|
+
### Global commands
|
|
48
|
+
|
|
49
|
+
- `easy list`: Show installed services
|
|
50
|
+
- `easy list --all`: Show all available services from repository
|
|
51
|
+
- `easy search <query>`: Search available services
|
|
52
|
+
- `easy status` (alias: `easy ps`): Show running containers
|
|
53
|
+
- `easy init <service>`: Create a new local service template
|
|
54
|
+
- `easy help`: Show help
|
|
55
|
+
|
|
56
|
+
## Quick examples
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Start PostgreSQL
|
|
60
|
+
easy up postgres
|
|
61
|
+
|
|
62
|
+
# See what's installed
|
|
63
|
+
easy list
|
|
64
|
+
|
|
65
|
+
# See all available services
|
|
66
|
+
easy list --all
|
|
67
|
+
|
|
68
|
+
# Follow logs
|
|
69
|
+
easy logs postgres --follow
|
|
70
|
+
|
|
71
|
+
# Validate compose file
|
|
72
|
+
easy validate postgres
|
|
73
|
+
|
|
74
|
+
# Open shell in container
|
|
75
|
+
easy exec postgres
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Where services are stored
|
|
79
|
+
|
|
80
|
+
Installed services are stored in:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
~/.easy-containers/services/
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Each service directory usually contains:
|
|
87
|
+
|
|
88
|
+
- `docker-compose.yml`
|
|
89
|
+
- `env.sample` (if provided)
|
|
90
|
+
- `.env` (created/managed locally)
|
|
91
|
+
|
|
92
|
+
## Notes
|
|
93
|
+
|
|
94
|
+
- If a service is not installed, `easy up <service>` will try to download it first.
|
|
95
|
+
- Use `easy config <service>` to create/edit `.env` values safely.
|
|
96
|
+
- Use `easy down <service> --volumes` if you want to remove volumes too.
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { program } = require('commander');
|
|
4
|
+
const chalk = require('chalk');
|
|
5
|
+
const {
|
|
6
|
+
up,
|
|
7
|
+
down,
|
|
8
|
+
download,
|
|
9
|
+
list,
|
|
10
|
+
show,
|
|
11
|
+
status,
|
|
12
|
+
logs,
|
|
13
|
+
restart,
|
|
14
|
+
init,
|
|
15
|
+
pull,
|
|
16
|
+
exec,
|
|
17
|
+
search,
|
|
18
|
+
validate,
|
|
19
|
+
config,
|
|
20
|
+
help
|
|
21
|
+
} = require('../src/commands');
|
|
22
|
+
const { verifyDockerEnvironment } = require('../src/utils/docker.js');
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
// Package info
|
|
26
|
+
const packageJson = require('../package.json');
|
|
27
|
+
|
|
28
|
+
// ASCII Art Banner
|
|
29
|
+
const banner = `
|
|
30
|
+
${chalk.cyan('╔═══════════════════════════════════════╗')}
|
|
31
|
+
${chalk.cyan('║')} ${chalk.bold.white('🐳 Easy Containers CLI')} ${chalk.cyan('║')}
|
|
32
|
+
${chalk.cyan('║')} ${chalk.gray('Simplify Docker Management')} ${chalk.cyan('║')}
|
|
33
|
+
${chalk.cyan('╚═══════════════════════════════════════╝')}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
// Show banner
|
|
37
|
+
console.log(banner);
|
|
38
|
+
|
|
39
|
+
// Configure CLI
|
|
40
|
+
program
|
|
41
|
+
.name('easy')
|
|
42
|
+
.description('CLI tool for managing Docker containers easily')
|
|
43
|
+
.version(packageJson.version, '-v, --version', 'Output the current version')
|
|
44
|
+
.helpOption('-h, --help', 'Display help for command')
|
|
45
|
+
.addHelpCommand(false);
|
|
46
|
+
|
|
47
|
+
// Up command - Start containers
|
|
48
|
+
program
|
|
49
|
+
.command('up <service>')
|
|
50
|
+
.description('Start a container service')
|
|
51
|
+
.option('-d, --detach', 'Run containers in detached mode (default)', true)
|
|
52
|
+
.option('-f, --file <file>', 'Specify an alternate compose file')
|
|
53
|
+
.action(async (service, options) => {
|
|
54
|
+
try {
|
|
55
|
+
await verifyDockerEnvironment();
|
|
56
|
+
await up(service, options);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Down command - Stop containers
|
|
64
|
+
program
|
|
65
|
+
.command('down <service>')
|
|
66
|
+
.description('Stop and remove containers')
|
|
67
|
+
.option('-v, --volumes', 'Remove named volumes')
|
|
68
|
+
.action(async (service, options) => {
|
|
69
|
+
try {
|
|
70
|
+
await verifyDockerEnvironment();
|
|
71
|
+
await down(service, options);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// List command - List services
|
|
79
|
+
program
|
|
80
|
+
.command('list')
|
|
81
|
+
.alias('ls')
|
|
82
|
+
.description('List installed container services')
|
|
83
|
+
.option('-a, --all', 'Show all available services from repository')
|
|
84
|
+
.option('-v, --verbose', 'Show detailed information including descriptions')
|
|
85
|
+
.action(async (options) => {
|
|
86
|
+
try {
|
|
87
|
+
await list(options);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// Download command - Download service files
|
|
95
|
+
program
|
|
96
|
+
.command('download <service>')
|
|
97
|
+
.description('Download service configuration from repository')
|
|
98
|
+
.action(async (service) => {
|
|
99
|
+
try {
|
|
100
|
+
await download(service);
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Show command - Show service details
|
|
108
|
+
program
|
|
109
|
+
.command('show <service>')
|
|
110
|
+
.description('Display detailed information about a service')
|
|
111
|
+
.action(async (service) => {
|
|
112
|
+
try {
|
|
113
|
+
await show(service);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Status command - Container status
|
|
121
|
+
program
|
|
122
|
+
.command('status')
|
|
123
|
+
.alias('ps')
|
|
124
|
+
.description('Show status of running containers')
|
|
125
|
+
.option('-v, --verbose', 'Show additional information')
|
|
126
|
+
.action(async (options) => {
|
|
127
|
+
try {
|
|
128
|
+
await verifyDockerEnvironment();
|
|
129
|
+
await status(options);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Logs command - View logs
|
|
137
|
+
program
|
|
138
|
+
.command('logs <service>')
|
|
139
|
+
.description('View container logs')
|
|
140
|
+
.option('-f, --follow', 'Follow log output')
|
|
141
|
+
.option('-n, --tail <lines>', 'Number of lines to show from the end', '100')
|
|
142
|
+
.option('-t, --timestamps', 'Show timestamps')
|
|
143
|
+
.action(async (service, options) => {
|
|
144
|
+
try {
|
|
145
|
+
await verifyDockerEnvironment();
|
|
146
|
+
await logs(service, options);
|
|
147
|
+
} catch (error) {
|
|
148
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// Restart command - Restart containers
|
|
154
|
+
program
|
|
155
|
+
.command('restart <service>')
|
|
156
|
+
.description('Restart a container service')
|
|
157
|
+
.action(async (service, options) => {
|
|
158
|
+
try {
|
|
159
|
+
await verifyDockerEnvironment();
|
|
160
|
+
await restart(service, options);
|
|
161
|
+
} catch (error) {
|
|
162
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Init command - Initialize new service
|
|
168
|
+
program
|
|
169
|
+
.command('init <service>')
|
|
170
|
+
.description('Initialize a new container service')
|
|
171
|
+
.option('-t, --template <template>', 'Use a template (basic, database, webapp)')
|
|
172
|
+
.action(async (service, options) => {
|
|
173
|
+
try {
|
|
174
|
+
await init(service, options);
|
|
175
|
+
} catch (error) {
|
|
176
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Pull command - Pull images
|
|
182
|
+
program
|
|
183
|
+
.command('pull <service>')
|
|
184
|
+
.description('Pull/update container images for a service')
|
|
185
|
+
.action(async (service, options) => {
|
|
186
|
+
try {
|
|
187
|
+
await verifyDockerEnvironment();
|
|
188
|
+
await pull(service, options);
|
|
189
|
+
} catch (error) {
|
|
190
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// Exec command - Execute command in container
|
|
196
|
+
program
|
|
197
|
+
.command('exec <service> [command...]')
|
|
198
|
+
.description('Execute a command in a running container')
|
|
199
|
+
.option('-i, --interactive', 'Keep STDIN open (interactive mode)', true)
|
|
200
|
+
.action(async (service, command, options) => {
|
|
201
|
+
try {
|
|
202
|
+
await verifyDockerEnvironment();
|
|
203
|
+
await exec(service, command, options);
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
206
|
+
process.exit(1);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// Search command - Search services
|
|
211
|
+
program
|
|
212
|
+
.command('search <query>')
|
|
213
|
+
.description('Search for available container services')
|
|
214
|
+
.action(async (query) => {
|
|
215
|
+
try {
|
|
216
|
+
await search(query);
|
|
217
|
+
} catch (error) {
|
|
218
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
219
|
+
process.exit(1);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// Validate command - Validate configuration
|
|
224
|
+
program
|
|
225
|
+
.command('validate <service>')
|
|
226
|
+
.description('Validate docker-compose configuration')
|
|
227
|
+
.action(async (service) => {
|
|
228
|
+
try {
|
|
229
|
+
await validate(service);
|
|
230
|
+
} catch (error) {
|
|
231
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
232
|
+
process.exit(1);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// Config command - Manage service configuration
|
|
237
|
+
program
|
|
238
|
+
.command('config <service>')
|
|
239
|
+
.description('Manage service configuration and environment variables')
|
|
240
|
+
.option('-e, --edit', 'Edit .env file in default editor')
|
|
241
|
+
.option('-s, --show', 'Show current configuration')
|
|
242
|
+
.option('-r, --reset', 'Reset to default configuration from sample')
|
|
243
|
+
.action(async (service, options) => {
|
|
244
|
+
try {
|
|
245
|
+
await config(service, options);
|
|
246
|
+
} catch (error) {
|
|
247
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
248
|
+
process.exit(1);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
// Help command - Enhanced guide
|
|
253
|
+
program
|
|
254
|
+
.command('help')
|
|
255
|
+
.description('Show detailed help and examples')
|
|
256
|
+
.action(async () => {
|
|
257
|
+
try {
|
|
258
|
+
await help();
|
|
259
|
+
} catch (error) {
|
|
260
|
+
console.error(chalk.red(`\n❌ Error: ${error.message}\n`));
|
|
261
|
+
process.exit(1);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// Parse arguments
|
|
266
|
+
program.parse(process.argv);
|
|
267
|
+
|
|
268
|
+
// Show help if no command provided
|
|
269
|
+
if (!process.argv.slice(2).length) {
|
|
270
|
+
program.outputHelp();
|
|
271
|
+
|
|
272
|
+
console.log(chalk.cyan('\nQuick Start:\n'));
|
|
273
|
+
console.log(chalk.gray(' easy up postgres # Start PostgreSQL'));
|
|
274
|
+
console.log(chalk.gray(' easy config postgres # Configure environment'));
|
|
275
|
+
console.log(chalk.gray(' easy status # Check running containers'));
|
|
276
|
+
console.log(chalk.gray(' easy logs postgres # View logs'));
|
|
277
|
+
console.log(chalk.gray(' easy down postgres # Stop PostgreSQL'));
|
|
278
|
+
console.log(chalk.gray('\n easy init myapp # Create new service'));
|
|
279
|
+
console.log(chalk.gray(' easy search mysql # Search services'));
|
|
280
|
+
console.log(chalk.gray(' easy list # List installed services\n'));
|
|
281
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "easy-containers",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI tool for managing Docker containers easily",
|
|
5
|
+
"main": "bin/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"easy": "bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node bin/cli.js",
|
|
11
|
+
"test": "jest",
|
|
12
|
+
"lint": "eslint ."
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"docker",
|
|
16
|
+
"docker-compose",
|
|
17
|
+
"containers",
|
|
18
|
+
"cli",
|
|
19
|
+
"devops"
|
|
20
|
+
],
|
|
21
|
+
"author": "Yash Rajput",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/arjavdongaonkar/easy-containers.git"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/arjavdongaonkar/easy-containers/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/arjavdongaonkar/easy-containers#readme",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"chalk": "^4.1.2",
|
|
33
|
+
"cli-table3": "^0.6.3",
|
|
34
|
+
"commander": "^11.1.0",
|
|
35
|
+
"inquirer": "^8.2.5",
|
|
36
|
+
"js-yaml": "^4.1.0",
|
|
37
|
+
"ora": "^5.4.1"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"eslint": "^8.54.0",
|
|
41
|
+
"jest": "^29.7.0"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=14.0.0"
|
|
45
|
+
}
|
|
46
|
+
}
|