# Requirements Manager

This tool helps to manage requirements written in Markdown.

## Install

Reqman is a binary file that must be stored in a directory.
The files can be found [here](http://download.schukai.com/tools/reqman/).

For Linux, the execution bit must still be set.

```bash
chmod u+x reqman
```

## Commands 

The date format for the output can be specified with the parameter `--date-format`.
The format can be looked up in the first column of the table below.

| Layout           | Java notation | C notation | Notes    |
|------------------|---------------|------------|----------|
| 2006-01-02       | yyyy-MM-dd    | %F         | ISO 8601 |
| 20060102         | yyyyMMdd      | %Y%m%d     | ISO 8601 |
| January 02, 2006 | MMMM dd, yyyy | %B %d, %Y  |          |
| 02 January 2006  | dd MMMM yyyy  | %d %B %Y   |          |
| 02-Jan-2006      | dd-MMM-yyyy   | %d-%b-%Y   |          |
| 01/02/06         | MM/dd/yy      | %D         | US       |
| 01/02/2006       | MM/dd/yyyy    | %m/%d/%Y   | US       |
| 010206           | MMddyy        | %m%d%y     | US       |
| Jan-02-06        | MMM-dd-yy     | %b-%d-%y   | US       |
| Jan-02-2006      | MMM-dd-yyyy   | %b-%d-%Y   | US       |
| 06               | yy            | %y         |          |
| Mon              | EEE           | %a         |          |
| Monday           | EEEE          | %A         |          |
| Jan-06           | MMM-yy        | %b-%y      |          |

### Help

There is help on the command line for each individual command.

```bash
reqman --help
```

### New Requiremants

A new request can be created with the following command. 

```bash
reqman requirements add --id 1425
```

A completely new file with a structure is created. The `--id 1425` is both the file name and the ID of the request.

All available fields are listed in the new file.

### Output a PDF

A pdf can be created using the following command:

```bash
reqman overview \
       print \
       --path=requirement/documents   \
       --column=ID \
       --column=Title  \
       --template=template/schukai.md  \
       --latex-template-path=requirement/template/schukai.latex \
       --output=report.pdf \
       --format=pdf
```

In this case the markdown files in the path `requirement/documents` are read.

A table with all requirements is created in the file and the two columns 
`ID` and `Title` are used. Additional columns can be added using additional options `--column`.

File `template/schukai.md` is used as a template.

The LaTeX template `requirement/template/schukai.latex` is used for the design of the pdf.

The output format is PDF and the filename of the pdf document is `report.pdf`.

You can use a complete directory or a subdirectory as the path.

### Output of the tasks

```bash
reqman tasks print --path=examples/
```

The output is then of the type:

| AUFGABE                        | BIS        | ERLEDIGT | DATEI                |
|--------------------------------|------------|----------|----------------------|
| das ist das erste todo 1       | —          | —        | ./req1/001-1425.md   |


### Output of the items

```bash
reqman requirements print --path examples/ --column ID --column Title 
```

The output is then of the type:

| ID  | TITEL          |
|-----|----------------|
| A1  | My requirement |

More columns can be added with `--column`.

### Output of privacy

```bash
reqman privacy print --path=example/ 
```

### Output of requirements

```bash
reqman requirements print --path=example/ --column=ID --column=
```

The output is then of the type:

| ID                 | GRUPPE       | NAME                     | TYP  | BESCHREIBUNG | BIS        | ERLEDIGT | AM         | VON | DATEI                |
|--------------------|--------------|--------------------------|------|--------------|------------|----------|------------|-----|----------------------|
| 23423-Beistellung1 | A1           | Beistellung eines Bildes | Bild | Großes Logo  | 2022-12-12 | ✓        | 2022-12-01 | Me  | ./req1/002/002-01.md |


### Output changelog

```bash
reqman changelog print --path=example/ 
```

The output is then of the type:

```
### 01.05.2022

- Requirement (R2)

### 24.01.2022

- Requirement (R1)

```

### Output report

```
requirements report --grouped-by ID 
```

This command produces two tables:

| Anforderung | Gesch | TIME SPENT | 
|-------------|-------|------------|
| ID1         | 40    | 1          |
| ID2         | 40    | 1          |
| ID3         | 40    | 1          |
| ID4         | 40    | 1          |
| ID5         | 40    | 2          |
| ID6         | 40    | 2          |
| ID7         | 40    | 2          |
| ID8         | 40    | 2          |
| ID9         | 40    | 2          |
| ID10        | 40    | 2          |
| ID11        | 40    | 3          |
| ID12        | 40    | 3          |
| ID13        | 40    | 3          |
| ID14        | 40    | 3          |
| ID15        | 40    | 3          |
| ID16        | 40    | 3          |
| ID17        | 40    | 3          |
| ID18        | 40    | 4          |
| ID19        | 40    | 4          |
| ID20        | 40    | 4          |
| ID21        | 40    | 4          |
| ID22        | 40    | 5          |
| ID23        | 40    | 5          |
| ID24        | 40    | 6          |
| ID25        | 40    | 6          |



1) Groups all estimates and adds up the estimate and the booked times. This allows you to see how much time you have spent.

| KEY | PLANNED VALUE | TIME SPENT | RATIO |
|:----|---------------|------------|-------|
| ID1 | 1000          | 75h0m0s    | 7.50  |

2) This table shows for each plan value the hours needed, the mean, the variance and the standard deviation.

| PLAN VALUE | TIME SPENT | MEAN | VARIANCE | STANDARD DEVIATION |
|------------|------------|------|----------|--------------------|
| 40         | 75h0m0s    | 3.00 | 2.08     | 1.44               |

On average, we needed 3 hours in the example.
However, we needed 6 hours for 2 requirements.

The variance, or standard deviation, gives us a measure of how accurate we are. 
The smaller the standard deviation, the better.

So what decision can we derive? If a new requirement is estimated at 
40, the hours offered should be between 3 and 5.

## Structure

### The Text

The individual requirements are Markdown files with integrated YAML structure. The YAML structure must
be introduced with `---` and closed with `...`.

The data from the YAML block can be integrated in the text via [placeholders](https://pkg.go.dev/text/template).

For example, the following statement can be used to include the items within the document.

```golang
{{ if .Items }}
**Items**

| ID                 | Name         |        Delivery until |                              Provided on |
|--------------------|--------------|----------------------:|-----------------------------------------:|
{{ range .Items 
 }}| {{ .ID }} | {{ .Name }} | {{ .DeliveryUntil.Format "02.Jan" }} | {{ .ProvidedOn.Format "02.Jan"  }} | 
{{ end }}

{{ end }}
```

If the PDF function is used, LaTeX commands can also be included in the text. For example, the LaTex instruction `/newline' leads to a line break.


## Latex

Individual LaTeX commands can be looked up here:

* [tug.ctan.org/info/latex-refsheet/LaTeX_RefSheet.pdf](http://tug.ctan.org/info/latex-refsheet/LaTeX_RefSheet.pdf)
* [www.uni-frankfurt.de/53485609/latexsheet.pdf](https://www.uni-frankfurt.de/53485609/latexsheet.pdf)
* [www.latex4ei.de/downloads/LaTeX_CheatSheet.pdf](https://www.latex4ei.de/downloads/LaTeX_CheatSheet.pdf)
* [download.schukai.com/tools/reqman/](http://download.schukai.com/tools/reqman/)