Metadata | |
---|---|
cEP | 0012 |
Version | 1.0 |
Title | coala's Command Line Interface |
Authors | Alexandru-Sorin Maxim mailto:[email protected] |
Status | Proposed |
Type | Feature |
This cEP describes the design of coala's Command Line Interface (the action selection screen). It intends to refactor the design released as part of coala 0.8.
Adds functionality alongside with a better interaction with the user. The final goal is for coala CLI to be more friendly, easier to read and use.
The following changes shall be made to the CLI:
- Remove most of the text from the action selection screen
- Use letters instead of numbers for selecting actions
- Allow chaining actions in a single input
- Add a 'selection action for all results' option
- Make
ApplyPatchAction
log the applied patch - Reprompt after running actions only if the action says so
- Set 'Do nothing' as the default action
The section below describes why these changes should be done.
Most of the people who use a CLI program do not read the whole output, only a small part of it. Also, a large output from a command could tire them and could make them stop using our application. Remove the redundant information, keeping only the necessary information.
Letters are easier to be remembered rather than numbers. (Do (n)othing).
Users could apply more than one patch in a single input. The idea here is to offer more flexibility to our users. Instead of just 1 number, the user could enter more actions.
Now users have the possibility to choose at every result an action. Adds the possibility to choose an action for all results.
This is an option that lets user choose whether they want another action after the current action is done. This way, users will have the flexibility in their hands.
If a user chooses a non-existent action (or the input is wrong) just exit from the program with 'Do nothing'. This is for reuse of 'Do nothing'.
The section below describes how we should make these changes.
Most of the text that should be changed is in the 'ConsoleInteraction.py' file. Make changes in the 'ConsoleInteraction.py' based on the feedback gathered with Google Form.
Usage of letters would make usage of coala faster, as one could just remember
that a
stands for 'apply patch' for instance, and they would not have to check
the list for every result to see what number 'apply patch' has been assigned.
Do masive changes in 'result_actions' directory where are kept all the actions.
Mockup:
[ ] Do (N)othing
[ ] (O)pen file
[ ] (A)pply the patch
[ ] Add (i)gnore comment
[ ] (C)hain actions
[ ] Choose an action:
If a user will press 'C':
[ ] Enter the letters of the patches you want to apply ('-' between any letter): a-i-n
Any combination of letters (upper/lower) will be accepted (e.g: a-I-N). If one of the actions requested isn't possible, a warning will be printed (after all possible actions are applied) with the letter that couldn't be satisfied.
- Create a new file 'ChainAction.py' and a new class 'ChainAction' in 'result_actions' directory
- Implement the logic in the new class
- Parse corectly the input
- Use the new class in 'ConsoleInteraction'
Mockup:
[ ] Do (N)othing
[ ] (O)pen file(s)
[ ] (A)pply the patch
[ ] Add (i)gnore comment
[ ] (C)hain actions
[ ] (S)elect action for all results
[ ] Choose an action:
If the user will press 'S':
==== Apply an action for all results ====
[ ] Do (N)othing
[ ] (O)pen file
[ ] (A)pply the patch
[ ] Add (I)gnore comment
[ ] Choose an action:
So, let's say that a user wants to add an ignore comment in all files. The user should choose '(S)elect action for all results' and after choose the 'i' option. This will add an ignore comment in all of the files used in coafile/command without asking another action.
This should work if the user chooses to (C)hain actions.
[ ] Enter the letters of the patches you want to apply ('-' between any letter): a-i-n
[ ] Reprompt after running actions (Y/N)?
If the user chooses 'Y', after all the actions are applied, the interface will be reprompted with the possible actions.
[ ] Do (N)othing
[ ] (O)pen file
[ ] (A)pply the patch
[ ] Add (i)gnore comment
[ ] (C)hain actions
[ ] (S)elect action for all results
[ ] Choose an action: