Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Logic: Add command aliases #785

Closed
wants to merge 11 commits into from

Conversation

yamgent
Copy link
Member

@yamgent yamgent commented Jan 1, 2018

Part of #784. Rebased, and also added tests + docs.

Proposed commit message:

In order to invoke a command, the user has to type the full command
word. For example, to invoke the AddCommand, the user has to type
"add ...".

As such commands are commonly used, typing the full command word can
be inconvenient.

Let's teach AddressBookParser to accept command aliases as another
way of invoking the commands. For example, if the alias for
AddCommand is "a", the user can type "a n/John Doe" instead of
"add n/John Doe" to accomplish the same task.

Note: This PR is used as an example for future developers. Do not merge!

@CanIHasReview-bot
Copy link

v1

@yamgent submitted v1 for review.

(📚 Archive)

Checkout this PR version locally
git fetch https://github.com/se-edu/addressbook-level4.git refs/pr/785/1/head:BRANCHNAME

where BRANCHNAME is the name of the local branch you wish to fetch this PR to.

Copy link
Contributor

@Zhiyuan-Amos Zhiyuan-Amos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[8/11]

assertTrue(parser.parseCommand(HistoryCommand.COMMAND_ALIAS + " 3") instanceof HistoryCommand);

try {
parser.parseCommand("histories");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is unnecessary cos it's the exact same thing in the above test :P

Copy link
Contributor

@Zhiyuan-Amos Zhiyuan-Amos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[11/11] Missing update for select.

Copy link
Contributor

@Zhiyuan-Amos Zhiyuan-Amos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor nits! I'll just approve first; after this can tag prof for review ^^

@@ -46,6 +46,7 @@ e.g. typing *`help`* and pressing kbd:[Enter] will open the help window.
====
*Command Format*

* Some commands may have an alias, which you can also use to execute the command e.g. for `add`, its alias is `a`, so you can either type `add n/John Doe` or `a n/John Doe`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Some commands may have an alias
  2. e.g. for add, its alias is a, so you can either type add n/John Doe or a n/John Doe. e.g. to add a person to the address book, you can type either add n/John Doe or a n/John Doe.

@yamgent yamgent force-pushed the getting-started-logic branch 2 times, most recently from 0d8443a to 2cb223c Compare January 4, 2018 05:45
@CanIHasReview-bot
Copy link

v2

@yamgent submitted v2 for review.

(📚 Archive) (📈 Interdiff between v1 and v2)

Checkout this PR version locally
git fetch https://github.com/se-edu/addressbook-level4.git refs/pr/785/2/head:BRANCHNAME

where BRANCHNAME is the name of the local branch you wish to fetch this PR to.

@yamgent
Copy link
Member Author

yamgent commented Jan 4, 2018

@Zhiyuan-Amos thanks for the review.

@yamgent yamgent requested a review from damithc January 4, 2018 05:55
Copy link
Contributor

@damithc damithc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the PR @yamgent

@Zhiyuan-Amos
Copy link
Contributor

Oh @yamgent, have to update DG to link to this PR instead of the older PR.

@yamgent yamgent closed this Jan 7, 2018
@yamgent yamgent reopened this Jan 8, 2018
@yamgent yamgent added pr.Answer Pull request is answer for a tutorial in developer guide. Do not actually merge. and removed s.ToReview labels Jan 8, 2018
@yamgent yamgent mentioned this pull request Aug 4, 2018
7 tasks
In order to invoke AddCommand, the user has to type "add ...".

As the command is commonly used, typing the full command word
"add" can be troublesome.

Let's teach AddressBookParser to accept the alias "a" as another way
of invoking the AddCommand.
In order to invoke EditCommand, the user has to type "edit ...".

As the command is commonly used, typing the full command word
"edit" can be troublesome.

Let's teach AddressBookParser to accept the alias "e" as another way
of invoking the EditCommand.
In order to invoke SelectCommand, the user has to type "select ...".

As the command is commonly used, typing the full command word
"select" can be troublesome.

Let's teach AddressBookParser to accept the alias "s" as another way
of invoking the SelectCommand.
In order to invoke DeleteCommand, the user has to type "delete ...".

As the command is commonly used, typing the full command word
"delete" can be troublesome.

Let's teach AddressBookParser to accept the alias "d" as another way
of invoking the DeleteCommand.
In order to invoke ClearCommand, the user has to type "clear".

As the command is commonly used, typing the full command word
"clear" can be troublesome.

Let's teach AddressBookParser to accept the alias "c" as another way
of invoking the ClearCommand.
In order to invoke FindCommand, the user has to type "find ...".

As the command is commonly used, typing the full command word
"find" can be troublesome.

Let's teach AddressBookParser to accept the alias "f" as another way
of invoking the FindCommand.
In order to invoke ListCommand, the user has to type "list".

As the command is commonly used, typing the full command word
"list" can be troublesome.

Let's teach AddressBookParser to accept the alias "l" as another way
of invoking the ListCommand.
In order to invoke HistoryCommand, the user has to type "history".

As the command is commonly used, typing the full command word
"history" can be troublesome.

Let's teach AddressBookParser to accept the alias "h" as another way
of invoking the HistoryCommand.
In order to invoke UndoCommand, the user has to type "undo".

As the command is commonly used, typing the full command word
"undo" can be troublesome.

Let's teach AddressBookParser to accept the alias "u" as another way
of invoking the UndoCommand.
In order to invoke RedoCommand, the user has to type "redo".

As the command is commonly used, typing the full command word
"redo" can be troublesome.

Let's teach AddressBookParser to accept the alias "r" as another way
of invoking the RedoCommand.
@CanIHasReview-bot
Copy link

v3

@yamgent submitted v3 for review.

(📚 Archive) (📈 Interdiff between v2 and v3) (📈 Range-Diff between v2 and v3)

Checkout this PR version locally
git fetch https://github.com/se-edu/addressbook-level4.git refs/pr/785/3/head:BRANCHNAME

where BRANCHNAME is the name of the local branch you wish to fetch this PR to.

@yamgent yamgent requested a review from a team August 9, 2018 03:54
@yamgent
Copy link
Member Author

yamgent commented Aug 9, 2018

Changelog:

  • 79a313f: We must now use PersonUtil#getEditPersonDescriptorDetails(EditPersonDescriptor) instead of PersonUtil#getPersonDetails(Person) when generating the input command for editing a particular person.

@yamgent yamgent requested review from damithc and removed request for damithc August 10, 2018 01:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr.Answer Pull request is answer for a tutorial in developer guide. Do not actually merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants