Skip to content

Latest commit

 

History

History
167 lines (121 loc) · 5.29 KB

cEP-0012.md

File metadata and controls

167 lines (121 loc) · 5.29 KB

coala's Command Line Interface

Metadata
cEP 0012
Version 1.0
Title coala's Command Line Interface
Authors Alexandru-Sorin Maxim mailto:[email protected]
Status Proposed
Type Feature

Abstract

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.

Changes

The following changes shall be made to the CLI:

  1. Remove most of the text from the action selection screen
  2. Use letters instead of numbers for selecting actions
  3. Allow chaining actions in a single input
  4. Add a 'selection action for all results' option
  5. Make ApplyPatchAction log the applied patch
  6. Reprompt after running actions only if the action says so
  7. Set 'Do nothing' as the default action

The section below describes why these changes should be done.

Why

Remove most of the text from the action selection screen

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.

Use letters instead of numbers for selecting actions

Letters are easier to be remembered rather than numbers. (Do (n)othing).

Allow chaining actions in a single input

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.

Add a 'select action for all results' option

Now users have the possibility to choose at every result an action. Adds the possibility to choose an action for all results.

Reprompt after running actions

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.

Set 'Do nothing' as the default action

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.

How

Remove most of the text from the action selection screen

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.

Use letters instead of numbers for selecting actions

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.

Allow chaining actions in a single input

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.

  1. Create a new file 'ChainAction.py' and a new class 'ChainAction' in 'result_actions' directory
  2. Implement the logic in the new class
  3. Parse corectly the input
  4. Use the new class in 'ConsoleInteraction'

Add a 'select action for all results' option

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.

Reprompt after running actions

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: