Improved user-friendliness. Closes #7

Every function is now a separate subcommand:
 * append (append a key, a modifier, or a string to one or more pedals)
 * clear (clear one or more pedals)
 * help (print a help message)
 * list (print a table with all possible keys)
 * read (read values from the footpedal)
 * set (set a key or mousebutton to one or more pedals)

A disadvantage is that different subcommands cannot be combined in one
call of the application anymore. However, this new structure brings the
major benefit that the program is more intuitive for users.

A second, small change is the fact that the welcome() function now reads
application and authore name from the Cargo file.
This commit is contained in:
2018-11-14 00:20:51 +01:00
parent dc9def512c
commit 74e23a5b5f
4 changed files with 215 additions and 81 deletions

View File

@@ -26,10 +26,15 @@ macro_rules! error {
};
}
pub fn welcome(string: &str) {
println!("{}", "".repeat(string.len() + 20));
println!("{text:^-width$}", text = string, width = string.len() + 20);
println!("{}", "".repeat(string.len() + 20));
pub fn welcome() {
const AUTHORS: &'static str = env!("CARGO_PKG_AUTHORS");
const NAME: &'static str = env!("CARGO_PKG_NAME");
let name_authors = &[NAME, " | ", AUTHORS].concat();
println!("{}", "".repeat(name_authors.len() + 20));
println!("{text:^-width$}", text = name_authors, width = name_authors.len() + 20);
println!("{}", "".repeat(name_authors.len() + 20));
}
pub fn goodbye() {