DEV Community

Pedro Osternack Corrêa
Pedro Osternack Corrêa

Posted on

Being lazy with PowerShell

So this is a brief introduction to give some context to some posts that I want to make. I'm putting this as a its own post so I can focus on the code and solution on the next ones.

The problem

Currently I'm working on a project with several different repos and I need to switch between them constantly. Everything works well, the repos are on my c:\src folder, so navigate to them using regular methods (cd /src/repo-name-here) with a fair share of tab auto-complete is not a huge problem. But I've decide to try and make it as simple as possible, firstly because simplicity is good, second because I like the challenge and it's a good excuse to train my (fairly weak I must admit) pwsh muscles.

My idea is to be able to go to the desired folder as fast as possible regardless of where I'm on my system. Ideally having a function called repo1 that is a very simple script that will cd me to the right folder. I can surely do that by hand, create one function for each repo on my profile file and call it a day, but that's not fun :D (and doesn't scale well), so I want to create those functions programmatically (that goal may change on the future, let's see).

What's next

The idea is to do some research and incrementally enhance my solutions and I'll create new posts with my findings. I wanted to make a huge post with the whole exploration, but that would just take a long time to get done and I'd probably never finish it (:stares at the list of drafts on the dashboard:), so I've decided to try and make a series of posts and see how it goes.

See you on the next post.

For sure the problem is pretty simple and the solutions will probably be over-engineered, but that's the fun of this kind of exercise :D.

Discussion (1)

naruaika profile image
Naufan Rusyda Faikar

Can't wait to see!