colloquy: branch on widget type

This commit is contained in:
nick black 2020-03-27 05:51:52 -04:00
parent a64119931a
commit ddf206462b
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
3 changed files with 18 additions and 10 deletions

View File

@ -10,4 +10,8 @@ homepage = "https://nick-black.com/dankwiki/index.php/Notcurses"
[dependencies] [dependencies]
notcurses = ">= 1.2.3" notcurses = ">= 1.2.3"
clap = {version = ">= 2.33.0", features = ["yaml", "color", "suggestions"]}
[dependencies.clap]
version = ">= 2.33.0"
default-features = false
features = ["yaml", "color", "suggestions"]

View File

@ -1,17 +1,17 @@
name: colloquy name: colloquy
version: "0.1.0" version: "0.1.0"
about: Attractive UI widgets from the shell about: Attractive Notcurses UI widgets from the shell
author: Nick Black <dankamongmen@gmail.com> author: Nick Black <dankamongmen@gmail.com>
args: args:
- verbose: - verbose:
long: verbose long: verbose
short: v short: v
help: Verbose mode help: Verbose mode
- file: # - file:
long: file # long: file
short: f # short: f
help: Read configuration options from this file # help: Read configuration options from this file
takes_value: true # takes_value: true
- title: - title:
long: title long: title
short: t short: t
@ -19,15 +19,13 @@ args:
- msgbox: - msgbox:
long: msgbox long: msgbox
help: Display arbitrary text with a single button to accept it help: Display arbitrary text with a single button to accept it
requires: text
- text: - text:
help: The contents of the widget help: The contents of the widget
required: true
index: 1 index: 1
- height: - height:
help: The height of the widget, 0 for screen height help: The height of the widget, 0 for screen height
required: true
index: 2 index: 2
- width: - width:
help: The width of the widget, 0 for screen width help: The width of the widget, 0 for screen width
required: true
index: 3 index: 3

View File

@ -2,4 +2,10 @@ fn main() {
use clap::{load_yaml, App}; use clap::{load_yaml, App};
let yaml = load_yaml!("cli.yml"); let yaml = load_yaml!("cli.yml");
let matches = App::from_yaml(yaml).get_matches(); let matches = App::from_yaml(yaml).get_matches();
if matches.is_present("msgbox") {
// do a messagebox
}else{
eprintln!("Needed a widget type");
std::process::exit(1);
}
} }