Set up the argument parser for deployment commands.
(subparsers)
| 201 | |
| 202 | |
| 203 | def setup_deploy_parser(subparsers): |
| 204 | """Set up the argument parser for deployment commands.""" |
| 205 | deploy_parser = subparsers.add_parser('deploy', help='Deployment operations') |
| 206 | deploy_subparsers = deploy_parser.add_subparsers(dest='deploy_command', help='Deployment command') |
| 207 | |
| 208 | # GitHub to AWS EC2 |
| 209 | github_to_ec2_parser = deploy_subparsers.add_parser('github-to-ec2', help='Deploy from GitHub to EC2') |
| 210 | github_to_ec2_parser.add_argument('--repo', required=True, help='GitHub repository (owner/repo)') |
| 211 | github_to_ec2_parser.add_argument('--instance-id', required=True, help='EC2 instance ID') |
| 212 | github_to_ec2_parser.add_argument('--branch', default='main', help='GitHub branch') |
| 213 | github_to_ec2_parser.add_argument('--path', default='/var/www/html', help='Deployment path on instance') |
| 214 | github_to_ec2_parser.add_argument('--setup-script', help='Setup script to run after deployment') |
| 215 | github_to_ec2_parser.add_argument('--region', help='AWS region') |
| 216 | |
| 217 | # GitHub to AWS S3 (static website) |
| 218 | github_to_s3_parser = deploy_subparsers.add_parser('github-to-s3', help='Deploy from GitHub to S3') |
| 219 | github_to_s3_parser.add_argument('--repo', required=True, help='GitHub repository (owner/repo)') |
| 220 | github_to_s3_parser.add_argument('--bucket', required=True, help='S3 bucket name') |
| 221 | github_to_s3_parser.add_argument('--branch', default='main', help='GitHub branch') |
| 222 | github_to_s3_parser.add_argument('--source-dir', help='Source directory in repository') |
| 223 | github_to_s3_parser.add_argument('--region', help='AWS region') |
| 224 | |
| 225 | |
| 226 | def format_output(data, format_type='table'): |