Implement Git by Yourself (3: Command Parameters)

Feng Gao
Nov 14, 2020

--

Implement Git series

As a CLI program, ugit must have to accept multi-commands according to the various input. For example

> ugit init
> ugit add a.txt

C# doesn’t support command parameters parse very well. CommandLine does the job very well.

Now, we add commit command which accepts a required message parameter. what’s more, you can customize the parameter such short verb and long verb forms.

How to use these option?

By default, this package supports up to 16 options. But in ugit, it probably exceeds that. What we need to do is just adding ParserResult<object> and Parser extension method.

So the ugit basic workflow is obvious.

--

--

Feng Gao

A software developer in Microsoft at Suzhou. Most articles spoken language is Chinese. I will try with English when I’m ready