Skip to content

Commit

Permalink
viewer: Prettify help output
Browse files Browse the repository at this point in the history
The options in sixtyfps-viewer --help used to look like this:

```
OPTIONS:
        --backend <backend>                         The rendering backend [default: ]
    -I <include path for other .60 files>...
        --load-data <load data file>                Load properties from a json file ('-' for stdin)
        --save-data <save data file>                Store properties values in a json file at exit ('-' for stdout)
        --style <style name>                        The style name ('native', 'fluent', or 'ugly') [default: ]
```

This patch removes the useless "[default: ]" part. These are options,
so even without this text it should be very obvious that the `--style`
and the `--backend` parameters are indeed optional.
  • Loading branch information
hunger authored and ogoffart committed Oct 5, 2021
1 parent b8ecbad commit d798947
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tools/viewer/main.rs
Expand Up @@ -31,12 +31,12 @@ struct Cli {
path: std::path::PathBuf,

/// The style name ('native', 'fluent', or 'ugly')
#[structopt(long, name = "style name", default_value)]
style: String,
#[structopt(long, name = "style name")]
style: Option<String>,

/// The rendering backend
#[structopt(long, name = "backend", default_value)]
backend: String,
#[structopt(long, name = "backend")]
backend: Option<String>,

/// Automatically watch the file system, and reload when it changes
#[structopt(long)]
Expand All @@ -62,8 +62,8 @@ fn main() -> Result<()> {
std::process::exit(-1);
}

if !args.backend.is_empty() {
std::env::set_var("SIXTYFPS_BACKEND", &args.backend);
if let Some(backend) = &args.backend {
std::env::set_var("SIXTYFPS_BACKEND", backend);
}

let fswatcher = if args.auto_reload { Some(start_fswatch_thread(args.clone())?) } else { None };
Expand Down Expand Up @@ -135,8 +135,8 @@ fn init_compiler(
) -> sixtyfps_interpreter::ComponentCompiler {
let mut compiler = sixtyfps_interpreter::ComponentCompiler::default();
compiler.set_include_paths(args.include_paths.clone());
if !args.style.is_empty() {
compiler.set_style(args.style.clone());
if let Some(style) = &args.style {
compiler.set_style(style.clone());
}
if let Some(watcher) = fswatcher {
notify::Watcher::watch(
Expand Down

0 comments on commit d798947

Please sign in to comment.