Skip to content

Commit

Permalink
Adjusted max width of help table and updated userguide expected outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelory committed Apr 15, 2024
1 parent f21a2a0 commit 3e1def7
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 61 deletions.
97 changes: 40 additions & 57 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,31 @@ Expected output:

```
Here is the table showing a list of commands you can use:
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| No. | Command | Explanation | Example |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 1 | new <bouquetName> | Add a bouquet | new Birthday Bouquet |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 2 | delete <bouquetName> | Delete a bouquets | delete Birthday Bouquet |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 3 | mybouquets | List current saved bouquets | mybouquets |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 4 | info <flowerName> | Provide information on chosen flower | info Rose |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 5 | add <flowerName> /c <colour> (optional) /q <quantity> | Add flower to a bouquet | add Rose /c Red /q 5 /to Birthday Bouquet |
| | /to <bouquetName> | | |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 6 | remove <flowerName> /c <colour> (optional) /q <quantity> | Remove flower from a bouquet | remove Rose /c Red /q 5 /from Birthday Bouquet |
| | /from <bouquetName> | | |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 7 | flowers | Shows a list of flowers that can be | flowers |
| | | added into mybouquets | |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 8 | flowers <occasion> | Shows a list of flowers associated | flowers Valentines |
| | | with said occasion | |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 9 | occasion | Shows a list of occasions associated | occasion |
| | | with available flowers | |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 10 | save <bouquetName> | Saves a bouquet to an external | save Birthday Bouquet |
| | | <bouquetName>.txt file | |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 11 | recommend | Recommends a bouquet based on the | recommend |
| | | chosen occasion and colour | |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 12 | compare <1st flowerName> /vs/ <2nd flowerName> | Show information regarding two flowers | compare Rose /vs/ Lily |
| | | side-by-side for comparison | |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
| 13 | bye | Exits the programme | bye |
+-----+----------------------------------------------------------+----------------------------------------+------------------------------------------------+
+-----+------------------------------------------------+----------------------------------------+------------------------------+
| No. | Command | Explanation | Example |
+-----+------------------------------------------------+----------------------------------------+------------------------------+
| 1 | new <bouquetName> | Add a bouquet | new Birthday Bouquet |
| 2 | delete <bouquetName> | Delete a bouquets | delete Birthday Bouquet |
| 3 | mybouquets | List current saved bouquets | mybouquets |
| 4 | info <flowerName> | Provide information on chosen flower | info Rose |
| 5 | add <flowerName> /c <colour> (optional) /q | Add flower to a bouquet | add Rose /c Red /q 5 /to |
| | <quantity> /to <bouquetName> | | Birthday Bouquet |
| 6 | remove <flowerName> /c <colour> (optional) /q | Remove flower from a bouquet | remove Rose /c Red /q 5 |
| | <quantity> /from <bouquetName> | | /from Birthday Bouquet |
| 7 | flowers | Shows a list of flowers that can be | flowers |
| | | added into mybouquets | |
| 8 | flowers <occasion> | Shows a list of flowers associated | flowers Valentines |
| | | with said occasion | |
| 9 | occasion | Shows a list of occasions associated | occasion |
| | | with available flowers | |
| 10 | save <bouquetName> | Saves a bouquet to an external | save Birthday Bouquet |
| | | <bouquetName>.txt file | |
| 11 | recommend | Recommends a bouquet based on the | recommend |
| | | chosen occasion and colour | |
| 12 | compare <1st flowerName> /vs/ <2nd flowerName> | Show information regarding two flowers | compare Rose /vs/ Lily |
| | | side-by-side for comparison | |
| 13 | bye | Exits the programme | bye |
+-----+------------------------------------------------+----------------------------------------+------------------------------+
```

### Create a new bouquet: `new`
Expand Down Expand Up @@ -144,13 +132,12 @@ Example: `info Lily`
Expected Output:
```
Here is a table of information about the flower Lily:
+-----+-------------+--------+--------------------+-------------+--------+-----------+
| No. | Flower Name | Colour | Occasion | Meaning | Type | Price ($) |
+-----+-------------+--------+--------------------+-------------+--------+-----------+
| 1 | Lily | White | [FUNERAL, WEDDING] | [Innocence] | FLOWER | 2.50 |
+-----+-------------+--------+--------------------+-------------+--------+-----------+
| 2 | Lily | Orange | [] | [Hatred] | FLOWER | 2.50 |
+-----+-------------+--------+--------------------+-------------+--------+-----------+
+-----+-------------+--------+------------------+-----------+-------------+-----------+
| No. | Flower Name | Colour | Occasion | Meaning | Type | Price ($) |
+-----+-------------+--------+------------------+-----------+-------------+-----------+
| 1 | Lily | White | Funeral, Wedding | Innocence | MAIN_FLOWER | 2.50 |
| 2 | Lily | Orange | - | Hatred | MAIN_FLOWER | 2.50 |
+-----+-------------+--------+------------------+-----------+-------------+-----------+
____________________________________________________________
```

Expand Down Expand Up @@ -295,19 +282,15 @@ Examples:
Expected output:
```
Here is a table of comparison between the two flowers:
+-----+-------------+--------------+------------------------------------+------------------------------------------+--------+-----------+
| No. | Flower Name | Colour | Occasion | Meaning | Type | Price ($) |
+-----+-------------+--------------+------------------------------------+------------------------------------------+--------+-----------+
| 1 | Rose | Dark crimson | [FUNERAL] | [Mourning] | FLOWER | 2.00 |
+-----+-------------+--------------+------------------------------------+------------------------------------------+--------+-----------+
| 2 | Rose | Red | [VALENTINES, WEDDING, MOTHERS_DAY] | [Love] | FLOWER | 2.00 |
+-----+-------------+--------------+------------------------------------+------------------------------------------+--------+-----------+
| 3 | Rose | Yellow | [] | [Jealousy, Decrease of love, Infidelity] | FLOWER | 2.00 |
+-----+-------------+--------------+------------------------------------+------------------------------------------+--------+-----------+
| 4 | Lily | White | [FUNERAL, WEDDING] | [Innocence] | FLOWER | 2.50 |
+-----+-------------+--------------+------------------------------------+------------------------------------------+--------+-----------+
| 5 | Lily | Orange | [] | [Hatred] | FLOWER | 2.50 |
+-----+-------------+--------------+------------------------------------+------------------------------------------+--------+-----------+
+-----+-------------+--------------+----------------------------------+----------------------------------------+-------------+-----------+
| No. | Flower Name | Colour | Occasion | Meaning | Type | Price ($) |
+-----+-------------+--------------+----------------------------------+----------------------------------------+-------------+-----------+
| 1 | Rose | Dark crimson | Funeral | Mourning | MAIN_FLOWER | 2.00 |
| 2 | Rose | Red | Valentines, Wedding, Mothers day | Love | MAIN_FLOWER | 2.00 |
| 3 | Rose | Yellow | - | Jealousy, Decrease of love, Infidelity | MAIN_FLOWER | 2.00 |
| 4 | Lily | White | Funeral, Wedding | Innocence | MAIN_FLOWER | 2.50 |
| 5 | Lily | Orange | - | Hatred | MAIN_FLOWER | 2.50 |
+-----+-------------+--------------+----------------------------------+----------------------------------------+-------------+-----------+
```

### Exit programme: `bye`
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/florizz/core/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.github.freva.asciitable.AsciiTable;
import com.github.freva.asciitable.Column;
import com.github.freva.asciitable.HorizontalAlign;
import com.github.freva.asciitable.OverflowBehaviour;
import florizz.objects.Bouquet;
import florizz.objects.Flower;
import florizz.objects.TableData;
Expand Down Expand Up @@ -172,13 +173,13 @@ public void printHelpMessage() {
, "bye")
);
System.out.println(AsciiTable.getTable(AsciiTable.BASIC_ASCII_NO_DATA_SEPARATORS, tableData, Arrays.asList(
new Column().header("No.").dataAlign(HorizontalAlign.CENTER)
new Column().header("No.").dataAlign(HorizontalAlign.CENTER).maxWidth(5, OverflowBehaviour.NEWLINE)
.with((TableData data) -> Integer.toString(data.getId())),
new Column().header("Command").dataAlign(HorizontalAlign.LEFT)
new Column().header("Command").dataAlign(HorizontalAlign.LEFT).maxWidth(48, OverflowBehaviour.NEWLINE)
.with(TableData::getCommand),
new Column().header("Explanation").dataAlign(HorizontalAlign.LEFT)
new Column().header("Explanation").dataAlign(HorizontalAlign.LEFT).maxWidth(40, OverflowBehaviour.NEWLINE)
.with(TableData::getExplanation),
new Column().header("Example").dataAlign(HorizontalAlign.LEFT)
new Column().header("Example").dataAlign(HorizontalAlign.LEFT).maxWidth(30, OverflowBehaviour.NEWLINE)
.with(TableData::getExample))));
printBreakLine();
}
Expand Down

0 comments on commit 3e1def7

Please sign in to comment.