· Copilot X · 2 min read
Using Copilot X CLI on my blog
Spending 10 minutes to automate a 5 minutes task with AI and bash scripts
A few days ago I was working on my blog leonardomontini.dev as I’d like to give it a strong restyle and move from Gatsby to Astro.
I also took the chance to change the folder structure of the current blog as it’s now flat and I wanted a more organized one.
Not too complicated, I wanted to group for year
and month
folders and move all the posts in the right one. For example, the post 2023-04-30_my-post/index.md
should be moved to 2023/04/my-post/index.md
.
There are ~50 articles right now, such a boring task to do manually and since it’s just a simple files/folders manipulation I thought a simple bash script could have been the solution… but it’s 2023, I didn’t want to write it myself and Google for the right commands when I can just ask an AI to write a wrong script for me :D
Copilot X CLI
I’ve recently got access to the Copilot CLI beta and I’m playing with it to see how it works but this seems like a real use case for it.
I actually didn’t plan to make a video out of it but I thought the process could have been interesting to share so I quickly turned on the lights, the webcam and started recording.
This is how it went:
Spoiler: it didn’t work on the first attempt, but it was definitely my fault for not noticing the error in the suggested script
Outcome
Running a script generated by an AI if you have no idea what is it going to do isn’t probably a wise choice, even if you can ask the AI to explain it. In my case, the task was quite simple and the outcome was easy to verify so it was a safe playground.
Actually, as you can see in the video, I was in a temporary folder AND I had an extra backup on a zip file. Better safe than sorry!
Are you using AI tools for generating scripts for you? Only easy scripts or also more complex ones? What questions are you asking or what problems are you solving with them?
Let me know in the comments! :D
Hello! My name is Leonardo and as you might have noticed, I like to talk about Web Development and Open Source!
I use GitHub every day and my favourite editor is Visual Studio Code... this might influence a little bit my conent! :D
If you like what I do, you should have a look at my YouTube Channel!
Let's get in touch, feel free to send me a DM on Twitter!