match available formatters by prefix #31
Labels
No Label
bug
config
feature
formatters
idea
new-command
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: categulario/tiempo-rs#31
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
so that it's not necessary to write their entire name.
To implement this, a few things need to change:
Right now the selection of the formatter is done by parsing the argument given by command line matching for the exact name of a predefined formatter and if not, it is assumed that it is a custom formatter.
To match by prefix we would probably need to first collect all the available formatter's names (predefined and custom) as a sorted vector of strings and then try to match the best prefix, taking care that if the prefix is ambiguous we notify the user. All this code can probably live in
formatters.rs
.The new matching mechanism has to be used in
src/commands/display.rs:109
and the rest of the "display" family of commands (month, today, week, yesterday). Matching unit tests can be done on the matching function but at least one test would need to emulate the passing of the args from cli for every command that receives a--format
argument.Things to do:
csv
andcsv_better
). Unit test for this.display
month
today
week
yesterday
Further questions
t f
ort l --formatters
)changed the description
changed the description