DEV Community

Phan Hieu Nguyen
Phan Hieu Nguyen

Posted on

Parallel features with Git

Summary

I worked on two feature at the same time and then merged it with master branch. Just a recap, the project is a cli tool that check healthy links in HTML files.
Repo link
Merge commit

Features

First new feature was giving option for users to choose whether they prefer colored output or non-colored output. Second new feature was giving option for users to choose only view healthy links or only bad links or all links.

Challenges

Adding more options/flags so far for me is add more nesting if checks. Second challenge was working on two feature parallelly and later on merged them. Merging is simple so far but in my experience, it's one of the most painful task in collaboration.

Lessons

I want to code better when adding more features. I cannot keep adding more nested if check for print every time.

Top comments (1)

Collapse
 
cipharius profile image
Valts Liepiņš

As you've already noticed, it's pain to maintain command line arguments as nested if statements. Usually CLI tools approach argument parsing problem more decleratively, by defining all possible command arguments and leaving the parsing up to dedicated argument parsing library.

Python comes with one called argparse. Take a look at the examples in the documentation and you'll see the benefits of this sort of approach: docs.python.org/3/library/argparse...

Besides specifying arguments like this avoids the issue of complicated merges!