This is a submission for the Amazon Q Developer "Quack The Code" Challenge: Crushing the Command Line
What I Built
Each month, I had various devices that were not prepared to update the scripts for updating the applications and systems. Searching for the appropriate commands may take time. I remembered the tasks that I should do, but unfortunately forgot the scripts or commands. Let's ask Amazon Q for help to prepare the scripts.
Demo
Using Amazon Q Chat
First Task
Updating essential apps, for example, AWS CLI.
- First Simple Prompt
- First Simple Prompt Verification
Second Task
Cleaning caches
- Second Simple Prompt
- Second Simple Prompt Verification
Third Task
Back up the scripts into a directory and/or a repository.
- Moving the scripts
- Adding the context and creating a README
Well, I can also create the repository on GitHub without leaving the chat! Awesome!
Example prompt:
Create the repository in GitHub using the GitHub CLI
Note:
- I've set up the CLI before. So it will be done seamlessly.
Code Repository
System Maintenance Scripts
This directory contains scripts for various system maintenance tasks, primarily focused on package manager cache cleanup and AWS CLI updates.
Available Scripts
Package Manager Cache Cleanup
Script: clear-package-caches.sh
This script cleans the caches for multiple package managers:
- npm: Clears the npm cache using
npm cache clean --force
- apt: Cleans the apt cache using
sudo apt-get clean
- NuGet: Clears NuGet caches using either
nuget locals all -clear
ordotnet nuget locals all --clear
- pip: Purges the pip cache using
pip cache purge
orpip3 cache purge
The script checks for the presence of each package manager before attempting to clear its cache, so it's safe to run even if some package managers aren't installed.
Usage:
./clear-package-caches.sh
AWS CLI Update Scripts
AWS CLI Version 2 Update
Script: update-aws-cli-v2.sh
Updates AWS CLI version 2 (recommended version) by:
- Downloading the latest installer from AWS
- Extracting and running the update process
- Cleaning…
How I Used Amazon Q Developer
I write a concise prompt for my recurring tasks. Detailed usage, explained in each section of the Demo.
Tips:
- Write the prompt as concisely as you can.
- Adding context will be helpful.
Top comments (0)