diff --git a/docs/UserGuide.adoc b/docs/UserGuide.adoc index 92c6c85bf9f..0ff0b6ecb58 100644 --- a/docs/UserGuide.adoc +++ b/docs/UserGuide.adoc @@ -12,7 +12,7 @@ ifdef::env-github[] :tip-caption: :bulb: :note-caption: :information_source: endif::[] -:repoURL: https://github.com/AY1920S1-CS2103T-W11-1/main/tree/master +:repoURL: https://github.com/AY1920S1-CS2103T-W11-1/main By: `Team CS2103T-W11-1` Since: `Sep 2019` Licence: `MIT` @@ -27,7 +27,7 @@ AlgoBase (AB) is for those who prefer to use a desktop app for managing algorith . Copy the file to the folder you want to use as the home folder for your AlgoBase application. . Double-click the file to start the app. The GUI should appear in a few seconds. + -image::Ui.png[width="790"] +image::Ui.png[width="80%"] + . Type the command in the command box and press kbd:[Enter] to execute it. + e.g. typing *`help`* and pressing kbd:[Enter] will list all possible commands in the result window and open the help window. @@ -35,6 +35,14 @@ e.g. typing *`help`* and pressing kbd:[Enter] will list all possible commands in * *`list`* : lists all problems * **`add`**`n/factorial d/define a function factorial that takes in a number and n and returns the factorial of the number t/recursion a/Halim` : adds a problem called 'factorial' tagged with 'recursion' and authored by 'Wee Han' +* **`edit`**`1 src/LeetCode` : edits the first problem displayed and sets its source to 'LeetCode' +* **`switchtab`**`t/display i/2` : switches to tag tab +* **`switchtab`**`t/display i/3` : switches to plan tab ++ +image::UiStartPlan.png[width="60%"] ++ +* **`findplan`**`n/CS2040` : finds plans that with name 'CS2040' +* **`clear`** : resets Algobase * *`exit`* : exits the app . Refer to <> for details of each command. @@ -262,7 +270,7 @@ Format: `add n/NAME [d/DESCRIPTION] [start/START_DATE] [end/END_DATE]` Examples: -* `addplan n/CS2040 d/past year questions in practical exams s/2019-01-01 e/3019-12-12` +* `addplan n/CS2040 d/past year questions in practical exams start/2019-01-01 end/3019-12-12` ==== Deleting a plan : `deleteplan` @@ -295,7 +303,7 @@ Examples: * `edit 1 d/past year questions of sit-in labs + Edits the description of the 1st plan to be `past year questions of sit-in labs` respectively. -* `edit 2 s/2019-08-13` + +* `edit 2 start/2019-08-13` + Edits the starting date of the 2nd plan to be `2019-08-13`. ==== Listing all plans : `listplan` @@ -362,7 +370,7 @@ Examples: ==== Locating plans: `findplan` Finds plans fulfilling all provided constraints. + -Format: `findplan [n/NAME] [d/DESCRIPTION] [start/RANGE_START] [end/RANGE_END]...` +Format: `findplan [n/NAME] [d/DESCRIPTION] [start/RANGE_START] [end/RANGE_END]` * Name ** is case-insensitive. @@ -460,7 +468,7 @@ Format: `rewind INDEX` kbd:[Ctrl + ↑] is shortcut for `rewind 1` [NOTE] -Since kbd:[Ctrl + ↑] is equivalent to executing `rewind 1`, you should not expect to rewind multiple commands back if you press the shortcut multiple times - it will always show you the last successfully executed command, if any. If you want to rewind several commands back +Since kbd:[Ctrl + ↑] is equivalent to executing `rewind 1`, you should not expect to rewind multiple commands back if you press the shortcut multiple times - it will always show you the last successfully executed command, if any. if you want to rewind several commands back, please use `rewind INDEX` instead. * `find n/Sequences` + `rewind 1` + @@ -519,11 +527,13 @@ e.g. `deletetag 3` * *Add Training Plan* : `addplan n/NAME [d/DESCRIPTION] [start/START_DATE] [end/END_DATE]` + e.g. `addplan n/CS2040` -* *Edit Training Plan* : `editplan INDEX [a/ADD_PROBLEM_INDEX_LIST] [d/DELETE_PROBLEM_INDEX_LIST] [n/NAME] [d/DESCRIPTION] [start/START_DATE] [end/END_DATE]` + -e.g. `editplan 1 a/1 2 3 d/4 5 6 n/training set 1` -* *Find Training Plan* : `findplan KEYWORD [MORE_KEYWORDS]` + -e.g. `find training set` +* *Edit Training Plan* : `editplan INDEX [n/NAME] [d/DESCRIPTION] [start/START_DATE] [end/END_DATE]` + +e.g. `editplan 1 n/training start/2020-02-02` +* *Find Training Plans* : `findplan [n/NAME] [d/DESCRIPTION] [start/RANGE_START] [end/RANGE_END]` + +e.g. `find n/CS2040 start/2019-03-01 end/2019-03-31` * *List Training Plans* : `listplan` +* *Delete Training Plan* : `deleteplan INDEX` + +e.g. `deleteplan 2` * *Add Task to Training Plan* : `addtask plan/PLAN_INDEX prob/PROBLEM_INDEX` + e.g. `addtask plan/1 prob/2` * *Delete Task from Training Plan* : `deletetask plan/PLAN_INDEX task/TASK_INDEX` + @@ -542,6 +552,9 @@ e.g. `export format/json path/.` * *Importing data* : `import format/FORMAT path/FILE_PATH` + e.g. `import format/json path/./steven_halim_secret.json` +* *Rewind Command History* : `rewind INDEX` + +e.g. `rewind 1` + * *Help* : `help` * *Clear* : `clear` * *Exit* : `exit` diff --git a/docs/images/UiStartPlan.png b/docs/images/UiStartPlan.png new file mode 100644 index 00000000000..0c92ceebab5 Binary files /dev/null and b/docs/images/UiStartPlan.png differ diff --git a/src/main/java/seedu/algobase/logic/parser/FindPlanCommandParser.java b/src/main/java/seedu/algobase/logic/parser/FindPlanCommandParser.java index a76e87188e3..499204b60e0 100644 --- a/src/main/java/seedu/algobase/logic/parser/FindPlanCommandParser.java +++ b/src/main/java/seedu/algobase/logic/parser/FindPlanCommandParser.java @@ -5,7 +5,7 @@ import static seedu.algobase.logic.parser.CliSyntax.PREFIX_END_DATE; import static seedu.algobase.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.algobase.logic.parser.CliSyntax.PREFIX_START_DATE; -import static seedu.algobase.logic.parser.ParserUtil.arePrefixesPresent; +import static seedu.algobase.logic.parser.ParserUtil.hasPrefixesPresent; import static seedu.algobase.logic.parser.ParserUtil.parseDate; import java.time.LocalDate; @@ -46,7 +46,8 @@ public FindPlanCommand parse(String args) throws ParseException { ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_DESCRIPTION, PREFIX_START_DATE, PREFIX_END_DATE); - if (!arePrefixesPresent(argumentMultimap, PREFIX_NAME) + if (!hasPrefixesPresent(argumentMultimap, PREFIX_NAME, PREFIX_DESCRIPTION, + PREFIX_START_DATE, PREFIX_END_DATE) || !argumentMultimap.getPreamble().isBlank()) { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindPlanCommand.MESSAGE_USAGE)); } diff --git a/src/main/java/seedu/algobase/logic/parser/ParserUtil.java b/src/main/java/seedu/algobase/logic/parser/ParserUtil.java index 7c28431a600..d45eb1ceae4 100644 --- a/src/main/java/seedu/algobase/logic/parser/ParserUtil.java +++ b/src/main/java/seedu/algobase/logic/parser/ParserUtil.java @@ -269,6 +269,14 @@ public static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Pref return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent()); } + /** + * Returns true if some of the prefixes contain present {@code Optional} values in the given + * {@code ArgumentMultimap}. + */ + public static boolean hasPrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) { + return Stream.of(prefixes).anyMatch(prefix -> argumentMultimap.getValue(prefix).isPresent()); + } + /** Parses a {@code String date} into an {@code LocalDate}. * * @throws ParseException if the given {@code date} is invalid.